December 8, 2010

Django deployment with uWSGI and NGinx: No Apache required!

uWSGI is a fast, clusterable WSGI server.

I've got nothing against Slicehost, but after buying the latest bundle, which included a $60 credit with Linode, I decided to make the switch.  After all, I get twice the RAM with Linode for the same price, and the ping times are already substantially faster.

For no particular reason, I decided to try uWSGI instead of mod_wsgi this time.  uWSGI has modules available for many servers, apache and nginx included. You run the uwsgi process (or a cluster thereof), tell nginx to hook up to it/them, and your app is served.  It reminds me a bit of mongrel with Apache, although that's probably totally wrong.

A chap named Simon Westphahl wrote a very nice post on deploying Django on nginx and uwsgi. I recommend you read it if you're looking to set something up.

I wrote this post with the intention of describing some caveats to the article linked above, but that was a month ago, so I don't remember them.  Ah well. I guess I'll just post a blanket recommendation to try uWSGI.  It is presently serving much faster than my (probably misconfigured) Apache + mod_wsgi setup.