Live data from Hacker News

Django Setup using Nginx and Gunicorn

senko.net

1–10 of 36 posts

Re: Django Setup using Nginx and Gunicorn

#2
Not a bad how-to...he mentioned the mod_wsgi route and that's the one I'm most fond of. You can still use Nginx to handle all static files and proxy all other requests to Django.

A tutorial link if you're interested: http://www.meppum.com/2009/jan/17/installing-django-ubuntu-i...

Re: Django Setup using Nginx and Gunicorn

#6
post #4

I'm not clear on the advantages of using nginx+Gunicorn over nginx+proxy-to-Apache/mod_wsgi

In reality, not that much. There's a pretty detailed benchmark breakdown here [1]. From my experience, the point where you see the different methods start to diverge is past the point you're going to be able to handle on a single box with a real-world application anyway. I find that gunicorn is slightly easier to setup (not requiring Apache to be installed, etc), so I've stuck with it. To each their own!

[1] http://nichol.as/benchmark-of-python-web-servers

Re: Django Setup using Nginx and Gunicorn

#9

Everyone always shows a single server setup. What if you have a dozen sites? You can't just give each one 9 processes, you will swamp your box. Is there any way to do a master setup where you can dynamically feed it your settings file?

If you're already running a dozen sites on one server, collectively they're probably not getting very much traffic. You may very well be able to use a large number of processes just fine.

Re: Django Setup using Nginx and Gunicorn

#10

Everyone always shows a single server setup. What if you have a dozen sites? You can't just give each one 9 processes, you will swamp your box. Is there any way to do a master setup where you can dynamically feed it your settings file?

it's pretty easy to add multiple upstream servers to nginx. If you're at that point you want to be reading the docs and understanding what's going on anyway.

Also gunicorn wants n+1 workers, where n is the number of cores you want to devote to it. It's in the docs. So an 8 core machine would want 9 workers.

If you've got multi server scaling issues, cut and paste won't help you.

Post reply on HN