Reputation: 145
I am using Django to develop a web application on the linux server.
When it comes to deployment, a proposed way is to use Nginx to communicate with the client and Django only need to communicate with Nginx with uwsgi protocol.
The relationship is client<-Http->Nginx<-uwsgi->Django server
Latter I found that I can also push the server on public network with
python manage.py runserver 0:0:0:0
It seems that the Nginx can help serve the static file and media.
My question is, what is exactly the benefit of using Nginx as the middleman?
Upvotes: 3
Views: 3066
Reputation: 634
runserver
is for debugging, in production we use gunicorn/uwsgi to boot the django app, so the question can be Do we need Nginx if we have configured gunicorn/uwsgi for Django
, the answer is YES
, becuase compared with gunicorn/uwsgi, Nginx has following advantages
:
refer to more features: https://en.wikipedia.org/wiki/Nginx#HTTP_proxy_and_Web_server_features
Upvotes: 1
Reputation: 599460
From the docs on runserver:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
Upvotes: 4