Web Server Gateway Interface
The Python Web Server Gateway Interface ( WSGI ) is an interface specification that defines an interface between web servers and web application frameworks and Web Application Servers, in order to promote the portability of web applications on different servers.
The actual interface is on the application side of a function that must return an iterable object as a parameter to the environment variables and a function object ( ' start_response ' in the example) receives. The environment variables are passed as an associative array ( ' environ ' in the example). The function object is used to output the HTTP header; it is called from the server side, before the return value of the function is sent to the client.
Def app (environ, start_response ): start_response ( '200 OK ', [( ' content-type ',' text / plain ')] ) return [ ' Hello world! ']
In recent years, developed on the basis of a multitude of Python web application frameworks and web application servers. The difficulty was that the selection of a framework restricted the selection of the web server and vice versa. This made it difficult to decide on a system and further complicated the portability, if you wanted to use a different framework or another Web server later. To counteract this problem, the Python Web Server Gateway Interface was created - intended as a standard interface ( middleware ) between the two worlds. This should allow a separation of the web server and the underlying application, thereby increasing the portability of these.
So far very few websites for extensive use of WSGI have become known. Use is currently WSGI mainly through mod_wsgi in Apache Web servers or uwsgi in Nginx or Cherokee servers. Both solutions can be used as a stand-alone system service (daemon ) from the web server to operate separately and thus offer next -related security and performance advantages, convenient options for scaling and uninterrupted updates.
WSGI - compatible software
- Moin Moin