Live data from Hacker News

How to configure nginx and uWSGI to serve Django projects

blog.eyallupu.com

11–20 of 24 posts

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

#12
Why the need for these "how to configure" this and that when it can be as simple as runthisnowdamnit.py using gunicorn or cherrypy? Or you know, some other server which doesnt require learning and blogging about its configuration and various options it can be set up? Sure that might come in handy, when or rather if you ever face millions of users/load problems.

Wasnt the point of a web application framework that you could put it anywhere and type run and have it done, instead of having to think of process- or event- or thread- based serving and static files? Thats not python. Even php is simpler/better in this regard.

Its not so difficult to run an instance of a threaded/process/eventlet server and let your app do the work.

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

#13

Why the need for these "how to configure" this and that when it can be as simple as runthisnowdamnit.py using gunicorn or cherrypy? Or you know, some other server which doesnt require learning and blogging about its configuration and various options it can be set up? Sure that might come in handy, when or rather if you ever face millions of users/load problems. Wasnt the point of a web application framework that you…

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.

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

#14
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.

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

#15

Why the need for these "how to configure" this and that when it can be as simple as runthisnowdamnit.py using gunicorn or cherrypy? Or you know, some other server which doesnt require learning and blogging about its configuration and various options it can be set up? Sure that might come in handy, when or rather if you ever face millions of users/load problems. Wasnt the point of a web application framework that you…

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) is like comparing bananas with oranges.

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

#16
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.

Varnish is just a proxy, or webcache, as I believe they like to call it. Nginx is needed because Varnish won't talk directly to the uwsgi processes, Varnish only understands http. The data that Varnish need to cache has to be supplied by a webserver somewhere and nginx is pretty nice and easily configurable. So I would assume that the idea is to use nginx as the webserver, not the cache/proxy.

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

#17

Why the need for these "how to configure" this and that when it can be as simple as runthisnowdamnit.py using gunicorn or cherrypy? Or you know, some other server which doesnt require learning and blogging about its configuration and various options it can be set up? Sure that might come in handy, when or rather if you ever face millions of users/load problems. Wasnt the point of a web application framework that you…

in both gunicorn and php you have to choose the number of workers/processes. Most of the time (unless you use php-fastcgi) the number of php processes is choosen by the sysadmin as it maps 1:1 with apache processes. The same is true for mod_wsgi. There is always some form of configuration independently by the load. One of the reasons for some users blaming at apache+mod_wsgi is because they maintain the default (bloated) apache configuration like php users/sysadmin tend to do.

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

#18

Earlier quoted context omitted.

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

Varnish is just a proxy, or webcache, as I believe they like to call it. Nginx is needed because Varnish won't talk directly to the uwsgi processes, Varnish only understands http. The data that Varnish need to cache has to be supplied by a webserver somewhere and nginx is pretty nice and easily configurable. So I would assume that the idea is to use nginx as the webserver, not the cache/proxy.

you can directly link uWSGI with varnish using http protocol instead of the uwsgi one: http://projects.unbit.it/uwsgi/wiki/Example#varnish

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

#19
WSGI supports native in-proc middleware for stuff like caching, but instead the author is accepting extra process boundaries between the HTTP stack and the remainder of their applications. I've never understood why I'm supposed to prefer that, so I would have liked to see a rationale.

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

#20
post #18

Earlier quoted context omitted.

Varnish is just a proxy, or webcache, as I believe they like to call it. Nginx is needed because Varnish won't talk directly to the uwsgi processes, Varnish only understands http. The data that Varnish need to cache has to be supplied by a webserver somewhere and nginx is pretty nice and easily configurable. So I would assume that the idea is to use nginx as the webserver, not the cache/proxy.

you can directly link uWSGI with varnish using http protocol instead of the uwsgi one: http://projects.unbit.it/uwsgi/wiki/Example#varnish

I did not know that... That's pretty awesome.
Post reply on HN