Simon Willison’s Weblog

Subscribe

Items tagged django, nginx

Filters: django × nginx × Sorted by date


Running gunicorn behind nginx on Heroku for buffering and logging

Heroku’s default setup for Django uses the gunicorn application server. Each Heroku dyno can only run a limited number of gunicorn workers, which means a limited number of requests can be served in parallel (around 4 per dyno is a good rule of thumb).

[... 400 words]

jacobian’s django-deployment-workshop. Notes and resources from Jacob’s 3 hour Django deployment workshop at PyCon, including example configuration files for Apache2 + mod_wsgi, nginx, PostgreSQL and pgpool. # 19th February 2010, 2:28 pm

Round-robin Django setup with nginx. An nginx trick I didn’t know: a low proxy_connect_timeout value (e.g. 2 seconds) combined with the proxy_next_upstream setting means that if one of your backends breaks a user won’t even see an error, they’ll just have a short delay before getting a response from a working server. # 21st December 2009, 3:43 pm

nginx_http_push_module. More clever design with webhooks—here’s an nginx module that provides a comet endpoint URL which will hang until a back end process POSTs to another URL on the same server. This makes it much easier to build asynchronous comet apps using regular synchronous web frameworks such as Django, PHP and Rails. # 17th October 2009, 4:48 pm

How to use Django with Apache and mod_wsgi. My favourite deployment option is now included in the official Django docs, thanks to Alex Gaynor. I tend to run a stripped down Apache with mod_wsgi behind an nginx proxy, and have nginx serve static files directly. This avoids the need for a completely separate media server (although a separate media domain is still a good idea for better client-side performance). # 1st April 2009, 12:24 am

The Django and Ubuntu Intrepid Almanac. Will Larson’s impressively comprehensive guide to configuring and securing an Ubuntu VPS from scratch to run Django, using PostgreSQL and Apache/mod_wsgi behind nginx. # 14th February 2009, 3:42 pm

oxfordgeeks.net

Nat and I had a bit of a mini-hackday this bank holiday Monday. Nat’s been doing a great job summoning local geeks out of the woodwork with Oxford Geek Nights event, but it’s still pretty hard to find other interesting events in the Oxfordshire area. It’s not that there aren’t any, it’s just that the geek community in Oxford is currently pretty fragmented.

[... 295 words]

Quick Django Benching. Django under Apache/mod_python outperforms nginx/FastCGI and LightTPD/FastCGI once you ramp up the concurrency levels. My setup for this site (Apache/mod_python behind an nginx proxy, with nginx handling static files) should give the best of both worlds. # 17th February 2007, 4:56 pm