WSGI in 3 Minutes

WSGI is a low-level interface between web servers (also called a gateway) and web applications (also called a framework).

WSGI is very simple: It defines the interface of just one callable object app(environ, start_response) that a web application provides to a web server. (You may observe some relics of CGI here, such as the environ variable.)

Of course, you should use higher level frameworks like Flask or Django to develop your WSGI application. Or use Werkzeug or wsgiref if you really want to go low level. See here and here for a brief survey of WSGI-compliant frameworks, servers, etc.

Middleware is merely a callable object that is called by a web server (or another middleware) and calls a web application (or another middleware). You could think of layers of middleware as an onion or a Unix pipeline.

WSGI interface is designed to accommodate both buffering and streaming mode of transmission.

Creative Commons License
This blog by Che-Liang Chiou is licensed under a Creative Commons Attribution 4.0 International License.