Web Server Gateway Interface

Web Server Gateway Interface

The Web Server Gateway Interface defines a simple and universal interface between web servers and web applications or frameworks for the Python programming language.

Idea

Historically 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 [ [http://www.python.org/dev/peps/pep-0333/ PEP 333] , Python Web Server Gateway Interface v1.0] (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.

pecification overview

The 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:
* Routing a request to different application objects based on the target URL, after changing the environment variables accordingly.
* Allowing multiple applications or frameworks to run side-by-side in the same process
* Load balancing and remote processing, by forwarding requests and responses over a network
* Perform content postprocessing, such as applying XSLT stylesheets

Example application

A WSGI compatible "Hello World" application in Python syntax:def app(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')] ) return ['Hello World ']

WSGI-compatible applications and frameworks

There are numerous Web application frameworks supporting WSGI:
* CherryPy
* Django [http://www.djangoproject.com/weblog/2005/jul/18/local_server/] Django with WSGI support]
* TurboGears
* [http://pyamf.org/ PyAMF]
* Pylons
* web.py ( [http://webpy.org/ webpy.org] )
* Zope 3
* Google App Engine
* web2py

Wrappers

The 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 [http://code.google.com/p/isapi-wsgi/ isapi-wsgi] , [http://pyisapie.sourceforge.net/ PyISAPIe] , or an ASP gateway).

References

External links

* [http://www.pythonpaste.org/ WSGI metaframework]
* [http://wsgi.org/ Comprehensive wiki about everything WSGI]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Web Server Gateway Interface — Das Python Web Server Gateway Interface (WSGI) ist ein Standard Interface zwischen Webservern und Web Application Frameworks bzw. Web Application Servern um die Portabilität von Webanwendungen auf unterschiedlichen Webservern zu fördern. Die… …   Deutsch Wikipedia

  • Web Server Gateway Interface — La Web Server Gateway Interface est une spécification qui définit une interface entre des serveurs et des applications web pour le langage Python. Voir aussi Common Gateway Interface Simple Common Gateway Interface FastCGI Variables d… …   Wikipédia en Français

  • Simple Common Gateway Interface — Le protocole Simple Common Gateway Interface (SCGI) est le remplaçant du protocole CGI. Il est similaire à FastCGI, mais il est plus facile à mettre en place. Voir aussi FastCGI Web Server Gateway Interface Variables d environnement CGI NCSA… …   Wikipédia en Français

  • Common Gateway Interface — This article is about the interface between a web server and an external application. For the term CGI in computer graphics, see Computer generated imagery. The Common Gateway Interface (CGI) is a standard (see RFC 3875: CGI Version 1.1) method… …   Wikipedia

  • Common Gateway Interface — La Common Gateway Interface (littéralement « Interface de passerelle commune »), généralement abrégée CGI, est une interface utilisée par les serveurs HTTP. Elle a été normalisée et décrite en version 1.1 dans la RFC 3875[1]. Sommaire 1 …   Wikipédia en Français

  • Web-Server — Der Host des ersten Webservers von Tim Berners Lee am CERN Ein Webserver (lat. servus, engl. server „Diener, Dienst“) ist ein Computer, der Dokumente an Clients wie z. B. Webbrowser überträgt. Als Webserver bezeichnet man den Computer mit… …   Deutsch Wikipedia

  • Web Server — Der Host des ersten Webservers von Tim Berners Lee am CERN Ein Webserver (lat. servus, engl. server „Diener, Dienst“) ist ein Computer, der Dokumente an Clients wie z. B. Webbrowser überträgt. Als Webserver bezeichnet man den Computer mit… …   Deutsch Wikipedia

  • Simple Common Gateway Interface — The Simple Common Gateway Interface (SCGI) is a protocol for applications to interface with HTTP servers, an alternative to the CGI protocol. It is similar to FastCGI but is designed to be easier to implement.The specification document was placed …   Wikipedia

  • Simple Common Gateway Interface — Das Simple Common Gateway Interface (SCGI) ist ein Standard für den Datenaustausch zwischen einem Webserver und dritter Software, die Anfragen bearbeitet. Es ist eine Alternative zu klassischem CGI und ähnelt dem FastCGI Protokoll. Die… …   Deutsch Wikipedia

  • Gateway — Cette page d’homonymie répertorie les différents sujets et articles partageant un même nom. Sur les autres projets Wikimedia : « Gateway », sur le Wiktionnaire (dictionnaire universel) Gateway est un mot anglais qui, au sens propre …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”