Deploy django applications with nginx, uwsgi, virtualenv, south, git and fabric, part 1
After googling for a while, asking my guru and some tests I was able to setup a deploy environment for django projects.
The web server is nginx, the database server mysql, I use uwsgi as wsgi server, all the code is versioned using git, the python libraries are installed in a virtualenv, db migration is assured by South and the deploy is automated using fabric.
While writing this post the whole environment is working but I think it may be adjusted in some ways, so let's take what follows as a guideline to improve in many aspects.
I assume we are working in locale and deploying directly to a production server, ignoring the staging phase.
Installing some packages (locale and remote)
To set up the environment we need python >= 2.6, python-dev, python-setuptools, pip and virtualenv, so (in a debian/ubuntu os):
$ sudo apt-get install python python-dev python-setuptools
$ sudo easy_install pip
$ pip install virtualenv
Ok that's all, the other python packages will be installed in the virtualenv, so now let's continue installing git and mysql
$ sudo apt-get install git ...