Python web and WSGI
How WSGI Web Server Gateway Inteface works
web server
|
WSGI server1------WSGI server2------WSGI server...
| |
WSGI framework1 WSGI framework2
| |
python codes python codes
web server
nginx, apache, etc.
It routes web requests to different WSGI servers, handles static images, etc. It's web front end and proxy router.
It basically forwards web requests to application server and responds with the returned responses from application server.
WSGI server
gunicorn, uWSGI, etc.
This is the application server. A website can have multiple application servers behind to support the website.
This is a container of web frameworks. It isolates web framework from web server, so the choice of web framework is more flexible.
It also promotes scaling. One can simply add more application servers to handle more requests.
WSGI framework
Flask, Bottle, etc.
It implements web framework, business logics, etc., call python codes