I read some introductions to wsgi on the Internet, but they basically talked about what wsgi is, but did not say how wsgi works specifically.
Simply put, I want to know how on a web server built with django+apache, when apache receives a request from a client, it passes the request to the django code.
Is the django code running in the apache process, or does it have its own process and communicate in some way?
If it runs in the apache process, then every time a new apache process is created, the django code will be reloaded?
ringa_lee2017-05-16 17:05:03
In fact, it is an intermediate communication protocol. As mentioned above, you can also use http. WSGI seems to have better performance. I can’t remember whether wsgi is the best at the moment. What I use here is uwsgi.Java. There is a similar communication protocol between HTTPServer and application container. A basic advantage of the two isolations is that static files can be provided directly using the httpServer service.
httpServer and the container are completely independent processes. To be precise, there can be more than two. You can open as many uwsgi as you like. They are completely configurable. For example, 4-6 uwsgi service processes can be opened at the same time to provide container services.
阿神2017-05-16 17:05:03
Apache
将请求直接转发给Django
,和直接访问Django
No difference
Official Documents
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/modwsgi/