One-command Django and PostgreSQL development environment on Vagrant.
This is a complete SaltStack configuration for a Django centric stack. It enables you setup a solid Django development environment with a single command. Some of the great things which are included:
- Local development, but the code is run within Ubuntu with the help of a share.
- Server running on uWSGI and Nginx. uWSGI reloads your python code automagically.
- PostgreSQL is installed and setup for you. No more explaining to your designer how to get the project running.
- Some helpfull Fabric functions, e.g., running
Table of Contents
- Django Salted
Django salted requires the following software to be installed on your machine:
All of the above are open-source and free to use.
Getting started (quick)
If you want to quickly try out what this is all about. Your installation will adhere to the default configuration and use the example Django project. If you have the requirements installed, it's just a single command:
After running this command, you should see the Django example website on: http://127.0.0.1:8080/. However, your database tables still need to be created. There is a fabric command to help you with that:
fab vagrant syncdb
You will also need to collect the static files to use the demo project. This can be done with fabric also:
fab vagrant collectstatic
The demo_project is a very simple project with the Djagno Admin http://127.0.0.1:8080/admin
The vagrant machine uses a virtual venvironment located at
After getting familiar with it, using Django Salted on your own project is simple done with changing a few settings.
- You will run and develop on the Django (1.5.1)
demo_projectinside the VM.
- Ubuntu 12.04 will be used as OS.
- Domain is: vagrant.django-salted.org
Modify for your own project
TODO: Write how to modify this repository for your own project.
How do I get the get the latest state/version?
The fastest way is to run
vagrant provision. The downfall is that you don't
see what's happening in colors. Or SSH to the box (my favourite) by doing the
vagrant ssh # On the box... sudo salt-call state.highstate
Which Operating Systems are supported?
Currently I have only tested it on Ubuntu 12.04 box. In the future there will be support for Debian and FreeBSD.
I'm getting "502 Bad Gateway" from Nginx
Ajj! This means uWSGI is down. It takes 15 seconds for uWSGI to spin up from a cold boot (because we have to wait on the Vagrant share). However, if after 15 seconds it's still not working, check out what went wrong by looking at the logs:
vagrant ssh sudo cat /var/log/uwsgi/example.log # or check the boss (emperor) sudo cat /var/log/uwsgi/emperor.log
Let me know in an issue if this is something I need to fix.
OMG, you also put the private key on Github?
Yes, this private key is used for the Vagrant example project. It's supposed to be there so you can spin up a box with a single command. Don't put your own private keys there.
Want to help?
Django-salted was created by Petar Radosevic. You can reach out to me on twitter at @wunki.
It's BSD Licensed. Use it however you want, just don't try to sell it back to me.