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-vbguestvagrant plugin install vagrant-librarian-chef-nochef- Windows only: Git, for using
vagrant sshon Windows easily
The following environment variables are required, and taken care of by vagrant provisioning:
DJANGO_SETTINGS_MODULE=config.settings.localDJANGO_SECRET_KEY=YOUR_KEY
Before first run:
- In
Vagrantfile, set yourProject Configuration for Vagrant - In
bash/django_setup.sh, replaceDATABASE_NAMEand set yourDJANGO_SECRET_KEY
vagrant upto start the VM and run initial provisioningpython src/manage.py createsuperuserto create a Django superuser- vagrant reload` to restart following the updates installed during provisioning
vagrant upvagrant ssh
- Use
python src/manage.py runserver 0.0.0.0:8000to start the server. - Append
--settings=config.settings.localto use a particular settings file.