Web Server Gateway Interface(WSGI)

🗓️ May 01, 2020 • ⌛ 1 min read

WSGI is the specification of Python. WSGI is a specification that describes how a web server communicates with the web application and how web servers can be chained to process a request. WSGI was created to standardise way to execute python code for web applications.


The advantages of WSGI include flexibility and helps to scale. Any WSGI web application/frameworks can be easily replaced with another. Example a Django app can be replaced with Flask. The same way replacements can happen between WSGI containers.

The working of WSGI is as follows. All request form client reaches the webserver, for example, NGINX and the web server forwards the request to the WSGI container. WSGI container invokes the callable in the WSGI application. The WSGI application then processes the request and sends back the response to the WSGI container which in turn is sent to the webserver and then back to the client.


WSGI servers

Green Unicorn, uWSGI, mod_wsgi, CherryPy


The central enemy of reliability is complexity