Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set mod_wsgi for apache and django?

I know that there are already a lot of information on this topic, but they are quite clumsy, not so simple and expressive. Could anyone explain me how to use django and with mod_wsgi and apache?

like image 775
user614189 Avatar asked Feb 12 '11 12:02

user614189


1 Answers

mod_wsgi isn't particularly the best fit for running Python WSGI applications, or, if you'd rather, there are more pythonic ways you can run your Django instance.

First off, I'd reason that it takes a lot of effort to understand Apache's request processing model and to configure it correctly, especially with respect to mod_wsgi. If your not exactly set or locked into using Apache, I would recommend that you take a look at running Spawning or Green Unicorn, behind a nginx proxy like @Neo suggested.

Spawning and gunicorn are both ridiculously fast, don't require that you compile Apache with a specific Python interpreter and provide support for progressively updating your code base on the fly, hooks for Django and other goodies out of the box. nginx, Spawning and gunicorn all have a simple processing model, are kept completely independent of each other, so you get a more transparent architecture that is easier to maintain and monitor.

Here's a great guide on setting up Spawning with Django by Eric Florenzano, and here's a thorough presentation on running Django with gunicorn by the project's author, Benoît Chesneau.

Whichever you choose, you'll be feeling right @home.

like image 149
Filip Dupanović Avatar answered Oct 05 '22 23:10

Filip Dupanović