- Apache 2.4, with mod_wsgi (Django)
- FreeTDS drivers for MS SQL Server
- PostgreSQL Drivers & Server
- Node + npm
This repository contains a CentOS 7.2 box for Vagrant. Python 3.5.3 is installed alongside the system Python (2.7.5). The Vagrant config uses a bootstrap.sh script, meant to illustrate steps for getting a development environment, with modules in a self-contained directory thanks to virtualenvwrapper.
MS SQL is also supported as a Django database backend with the FreeTDS ODBC Driver to SQL Server. PostgreSQL 9.5, including the server, can be install optionally for those using PostgreSQL.
Django versions 1.8 and greater are supported. Python 3.5 was first supported in Django 1.8. Django 1.8 is an LTS (Long Term Support) release, meaning it will be actively supported with bug fixes and security patches until at least April, 2018 (and probably longer): https://www.djangoproject.com/download/#supported-versions
- Tested with Vagrant 1.9.1:
- Tested with VirtualBox up to 5.0.24:
- Tested on: OS/X Yosemite, and El Capitan. MS Windows 7, 8, and 10.
- Windows note: we recommend using with Git Bash: https://git-for-windows.github.io/
- In Git Bash, click the diamond shaped multi-colored upper left icon, OPTIONS. You may want to go through the option list to increase your default window size, set up copy/paste shortcuts, and set up mouse selection for copy/paste.
- Windows: on newer machines, ensure that you have virtualization enabled in BIOS (Google it for your machine's model).
- Install Virtualbox https://www.virtualbox.org/wiki/Downloads
- Install Vagrant http://www.vagrantup.com/downloads
- Install git http://git-scm.com/downloads (Mac) or Git Bash https://openhatch.org/missions/windows-setup/install-git-bash (Windows)
- Create and add a public SSH key to your git server.
Clone the repository and bring up the virtual development environment. The first time you install the box, "vagrant up" will take a little while. Grab a cup of coffee or something!
git clone https://github.com/wharton/python-vagrant-centos7.git
cd python-vagrant-centos7
vagrant up
vagrant sshBy default, the host name will be set to vagrant.example.com. You can specify a host name like this:
$ VAGRANT_HOSTNAME="vagrant.my.domain.com" vagrant upYou can also add the host name to your computer's hosts file. Your hosts file should be located at:
- Mac / Linux: /etc/hosts
- Windows: %SystemRoot%\system32\drivers\etc\hosts
Add this line (with the appropriate host name, if you changed it):
192.168.99.100 vagrant.example.comOn your Vagrant box, a script has been provided to install PostgreSQL Server 9.6 and set up
the vagrant user as superuser alongside the system postgres user.
$ sudo /vagrant/assets/install_postgres.sh
$ psql
psql (9.6.2)
Type "help" for help.
vagrant=# \?
...
vagrant=# \q
The django-extensions app can build handy Entity Relationship Diagrams for Django apps, even your entire project. The pre-requisites for the Python packages are included with this Vagrant box.
First, install django-extensions and pygraphviz:
pip install django-extensions pygraphviz
Next, add django_extensions to your INSTALLED_APPS. Then you can create the diagrams; to create a PNG of all models in your Django project.
./manage.py graph_models -a -g -o project-erd.png
Or, to just do a few Django apps:
./manage.py graph_models users faculty courses -g -o users-faculty-courses.png
In Windows 10, the "World Wide Web Publishing Service" automatically starts on port 80. You can disable it so Vagrant can forward port 80.
- Click Start, type "Services" and open Services.
- Scroll down to World Wide Web Publishing Service. Right click and go into Properties.
- Change "Startup type" to be Manual.
- Click the "Stop" button.
- Click "OK".
Authors:
- Tim Allen (tallen@wharton.upenn.edu)
- Dave Roller (roller@wharton.upenn.edu)
