|
Article on other languages:
|
The Web Server Gateway Interface defines a simple and universal interface between web servers and web applications or frameworks for the Python programming language.
IdeaHistorically Python web application frameworks have been a problem for new Python users because, generally speaking, the choice of web framework would limit the choice of usable web servers, and vice versa. Python applications were often designed for either CGI, FastCGI, mod_python or even custom API interfaces of specific web-servers. WSGI[1] (sometimes pronounced 'whiskey' or 'wiz-gee') was created as a low-level interface between web servers and web applications or frameworks to promote common ground for portable web application development. WSGI is based on the existing CGI standard. Specification overviewThe WSGI interface has two sides: the "server" or "gateway" side, and the "application" or "framework" side. The server side invokes a callable object (usually a function or a method) that is provided by the application side. Additionally WSGI provides middleware; WSGI middleware implements both sides of the API, so that it can be inserted "between" a WSGI server and a WSGI application -- the middleware will act as an application from the server's point of view, and as a server from the application's point of view. A "middleware" component can perform such functions as:
Example applicationA WSGI compatible "Hello World" application in Python syntax: def app(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) return ['Hello World\n'] WSGI-compatible applications and frameworksThere are numerous Web application frameworks supporting WSGI: WrappersThe server or gateway invokes the application callable once for each request it receives from an HTTP client, that is directed at the application. Currently wrappers are available for FastCGI, CGI, SCGI, AJP (using flup), Apache (using mod_wsgi or mod_python) and Microsoft IIS (using isapi-wsgi, PyISAPIe, or an ASP gateway). ReferencesExternal links
|
||||||||||||||||||||||||||||||
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
Mercedes Car
This site monitored by SitePinger.net