views:

309

answers:

3

We are deploying django application, I found in the documentation that it is recommended to use WSGI appoach for doing that.

Before deploying I wanted to know, why it is recommended over other two approaches i.e. using mod_python and fastcgi...

Thanks a lot.

+4  A: 

We tried mod_python. It's slower and harder to configure. It doesn't offer the daemon feature.

We couldn't get fast_cgi built for our combination of Apache, Red Hat and Python. I'm not sure specifically what was wrong, but we couldn't get it built properly. It wouldn't dispatch requests to Django properly, and we couldn't diagnose the problem.

We tried mod_wsgi third. It built nicely. It has the daemon option. It's very easy to configure. It allows trivial restart of the Django applications without restarting all of Apache.

S.Lott
+10  A: 

wsgi is usually preferred because it decouples your choice of framework from your choice of web server: if tomorrow you want to move, say, from Apache to nginx, or whatever, the move is trivially easy with wsgi, not so easy otherwise.

Furthermore, using wsgi affords you the option to add some middleware that's framework-independent, rather than having to rely on every possible functionality you want having already been implemented and made available for your framework of choice.

Alex Martelli
Although your comments are valid in a general sense, the Django documentation actually recommends mod_wsgi as the deployment method and when OP says 'WSGI' he probably meant that. In other words, you can't forget that WSGI is an interface specification and not an actual implementation of a deployment mechanism. The mod_wsgi package is just one example of a WSGI deployment method. Technically FASTCGI deployment is also done by WSGI (via flup), and although Django supports mod_python directly, you can also put a WSGI adapter on it as well. OP thus probably wants to more know if mod_wsgi is okay.
Graham Dumpleton
A: 

I use mod_wsgi for any production Django app. It's fast, stable, and very configurable.

You may also want to look in to the FastCGI method a bit more. Eric Florenzano just did a great write up of Django with FastCGI for the Django Advent: http://djangoadvent.com/1.2/deploying-django-site-using-fastcgi/

Josh Wright