What is the point of uWSGI?

前端 未结 4 1942
后悔当初
后悔当初 2020-12-22 18:39

I\'m looking at the WSGI specification and I\'m trying to figure out how servers like uWSGI fit into the picture. I understand the point of the WSGI spec is to separate web

4条回答
  •  感情败类
    2020-12-22 19:17

    NGINX in this case only works as a reverse proxy and render static files not the dynamic files, it receives the requests and proxies them to the application server, that would be UWSGI.

    The UWSGI server is responsible for loading your Flask application using the WSGI interface. You can actually make UWSGI listen directly to requests from the internet and remove NGINX if you like, although it's mostly used behind a reverse proxy.

    From the docs:

    uWSGI supports several methods of integrating with web servers. It is also capable of serving HTTP requests by itself.

    WSGI is just an interface specification, in simple terms, it tells you what methods should be implemented for passing requests and responses between the server and the application. When using frameworks such as Flask or Django, this is handled by the framework itself.

    In other words, WSGI is basically a contract between python applications (Flask, Django, etc) and web servers (UWSGI, Gunicorn, etc). The benefit is that you can change web servers with little effort because you know they comply with the WSGI specification, which is actually one of the goals, as stated in PEP-333.

    Python currently boasts a wide variety of web application frameworks, such as Zope, Quixote, Webware, SkunkWeb, PSO, and Twisted Web -- to name just a few 1. This wide variety of choices can be a problem for new Python users, because generally speaking, their choice of web framework will limit their choice of usable web servers, and vice versa.

提交回复
热议问题