Web Server Gateway Interface
The Web Server Gateway Interface (WSGI) is a specification for simple and universal interface between web servers and web applications or frameworks for the Python programming language. It was originally specified in PEP 333 authored by Phillip J. Eby, and published on 7 December 2003. It has since been adopted as a standard for Python web application development. The latest version of the specification is v1.0.1, also known as PEP 3333, published on 26 September 2010.
Idea
Python web application frameworks had been a problem for new Python users because the choice of web framework would limit the choice of usable web servers, and vice versa. Python applications were often designed for only one of CGI, FastCGI, mod_python or some other custom API of a specific web server.
WSGI was created as a low-level interface between web servers and web applications or frameworks to promote common ground for portable web application development.
Specification overview
The WSGI has two sides: the "server" or "gateway" side (often a web server like Apache or Nginx), and the "application" or "framework" side (the python script itself). To process a WSGI request, the server side executes the application and provides environment information and a callback function to the application side. The application processes the request, and returns the response to the server side using the callback function it was provided.