Beginner-friendly starter files for a vagrant box running Django with PostgreSQL.
This assumes you've seperated requirements and settings into local, test, staging, production
as in Two Scoops, and that your Django project root is src
. You'll have to make a couple of minor changes if not.
- VirtualBox with Guest Additions
- Vagrant
vagrant plugin install vagrant-vbguest
vagrant plugin install vagrant-librarian-chef-nochef
- Windows only: Git, for using
vagrant ssh
on Windows easily
The following environment variables are required, and taken care of by vagrant provisioning:
DJANGO_SETTINGS_MODULE=config.settings.local
DJANGO_SECRET_KEY=YOUR_KEY
Before first run:
- In
Vagrantfile
, set yourProject Configuration for Vagrant
- In
bash/django_setup.sh
, replaceDATABASE_NAME
and set yourDJANGO_SECRET_KEY
vagrant up
to start the VM and run initial provisioningpython src/manage.py createsuperuser
to create a Django superuser- vagrant reload` to restart following the updates installed during provisioning
vagrant up
vagrant ssh
- Use
python src/manage.py runserver 0.0.0.0:8000
to start the server. - Append
--settings=config.settings.local
to use a particular settings file.