Live data from Hacker News

How to configure nginx and uWSGI to serve Django projects

blog.eyallupu.com

21–24 of 24 posts

Re: How to configure nginx and uWSGI to serve Django projects

#22
post #11

nginx, Varnish, and uWSGI are oh so awesome together. My app (I run a Pyramid based application) is lightning fast, and very easy to configure (much easier than mod_wsgi).

Why nginx AND varnish? I thought varnish could proxy as well? Or maybe could you explain your setup.

nginx is a much weaker proxy and doesn't allow as much customization as Varnish does. A coworker also ran into some basic HTTP compliance issues with nginx's cache and Vary headers - IIRC it simply ignores them outright. If you need more than very basic caching it's usually better to use Varnish because it's obsessively focused on doing that job well.

Depending on how you choose to implement it, this may also result in cleaner architecture if you have Varnish as a simple HTTP brick with little knowledge of the backend implementation, leaving all of the gory details to nginx.

Re: How to configure nginx and uWSGI to serve Django projects

#23
post #11

nginx, Varnish, and uWSGI are oh so awesome together. My app (I run a Pyramid based application) is lightning fast, and very easy to configure (much easier than mod_wsgi).

Why nginx AND varnish? I thought varnish could proxy as well? Or maybe could you explain your setup.

I basically use nginx the way people would use Apache and Varnish I use as a webcache. Others have explained it thoroughly.

Re: How to configure nginx and uWSGI to serve Django projects

#24
post #15

Earlier quoted context omitted.

Well i think the gist is that serving files and running applications have different resource requirements. Therefore it is common to have a proxy serve statics and proxy in addition to an application server running python. The advantage with uwsgi as i understand it is that the proxy protocol is faster than http.

No, uWSGI has nothing to do with performance. Its strength is in the features and operational modes. Each application is diferent from the others and (could) requires specific tuning. This is the spirit of the project, that is at the opposite of solutions like gunicorn. There is no "best choice", it depends on how you approach to system administration/development. Saying uWSGI is better than gunicorn (or the opposite…

I have only used apache as an application server with mod wsgi behind nginx. I have not used gunicorn or uwsgi. Yhanks for the correction, I should have just stopped my explanation before that.
Post reply on HN