Question: I am quite a noob when it comes to deploying a Django project. I'd like to know what are the various methods to deploy Django project and which one is the most preferred.

Answer: 
The Django documentation lists Apache/mod\_wsgi, Apache/mod\_python and FastCGI etc.

**mod\_python** is deprecated now, one should use mod\_wsgi instead. 

Django with **mod\_wsgi** is easy to setup, but: 

* you can only use one python version at a time [edit: you even can only use the python version mod\_wsgi was compiled for]
* [edit: seems if I'm wrong on mod\_wsgi not supporting virtualenv: it does]

So for multiple sites (targeting different django/python versions) on a server mod\_wsgi is not 
the best solution.

**FastCGI** can be used with virtualenv, also with different python versions, as you run it with 

```

./manage.py runfcgi …

```

and then configure your webserver to use this fcgi interface.

The new, hot stuff about django deployment seems to be **gunicorn**. It's a webserver that implements wsgi and is typically used as backend with a "big" webserver as proxy.

Deployment with **gunicorn** feels a lot like fcgi: you run a process doing the django processing stuff with manage.py, and a webserver as frontend to the world.

But gunicorn deployment has some advantages over fcgi:

* speed - I didn't find the sources, but benchmarks say fcgi is not as fast as the f suggests
* config files, for fcgi you must do all configuration on the commandline when executing the manage.py command. This comes unhandy when running multiple django instances via an init.d (unix-like OS' system service startup). It's always the same cmdline, with just different configuration files
* gunicorn can drop privileges: no need to do this in your init.d script, and it's easy to switch to one user per django instance
* gunicorn behaves more like a daemon: writing pidfile and logfile, forking to the background etc. makes again using it in an init.d script easier.

Thus, I would suggest to use the gunicorn solution, unless you have a single site on a single server with low traffic, than you could use the wsgi solution. But I think in the long run you're more happy with gunicorn.

If you have a django only webserver, I would suggest to use nginx as frontendproxy, as it's the best performing (again this is based on benchmarks I read in some blogposts - don't have the url anymore).
Personally I use apache as frontendproxy, as I need it for other sites hosted on the server.

A simple setup instruction for django deployment could be found here:
<http://ericholscher.com/blog/2010/aug/16/lessons-learned-dash-easy-django-deployment/>

My init.d script for gunicorn is located at github:
<https://gist.github.com/753053>

Unfortunately I did not yet blog about it, but an experienced sysadmin should be able to do the required setup.
I myself have faced a lot of problems in deploying Django Projects and automating the deployment process. Apache and mod\_wsgi were like curse for Django Deployment. There are several tools like [Nginx](http://wiki.nginx.org/Main), [Gunicorn](http://gunicorn.org/), [SupervisorD](http://supervisord.org/) and Fabric which are trending for Django deployment. At first I used/configured them individually without Deployment automation which took a lot of time(I had to maintain testing as well as production servers for my client and had to update them as soon as a new feature was tested and approved.) but then I stumbled upon django-fagungis, which totally automates my Django Deployment from cloning my project from bitbucket to deploying on my remote server (it uses Nginx, Gunicorn, SupervisorD, Fabtic and virtualenv and also installs all the dependencies on the fly), all with just three commands :) You can find more about it in my blog post [**here**](http://alirazabhayani.blogspot.com/2013/02/easy-django-deployment-tools-tutorial-fabric-gunicorn-nginx-supervisor.html). Now I even don't have to get involved in this process(which used to take a lot of my time) and one of my junior developers runs those three commands of django-fagungis [mentioned here](http://alirazabhayani.blogspot.com/2013/02/easy-django-deployment-tools-tutorial-fabric-gunicorn-nginx-supervisor.html) on his local machine and we get a crisp new copy of our project deployed in minutes without any hassle:)