What is WSGI?
WSGI is the Web Server Gateway Interface.
It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request.
WSGI is a specification, laid out in PEP 333, for a standardized interface between Web servers and Python Web frameworks/applications.
The goal is to provide a relatively simple yet comprehensive interface capable of supporting all (or most) interactions between a Web server and a Web framework. (Think "CGI" but programmatic rather than I/O based.)
An additional goal is to support "middleware" components for pre- and post-processing of requests: think gzip, recording, proxy, load-balancing.
Main Features
- WSGI gives you flexibility.
Application developers can swap out web stack components for others. For example, a developer can switch from Green Unicorn to uWSGI without modifying the application or framework that implements WSGI. From PEP 3333:
- WSGI servers promote scaling.
Serving thousands of requests for dynamic content at once is the domain of WSGI servers, not frameworks. WSGI servers handle processing requests from the web server and deciding how to communicate those requests to an application framework's process. The segregation of responsibilities is important for efficiently scaling web traffic.
Video for WSGI
https://www.youtube.com/watch?v=OMkOQFoUFZg