Web Server Gateway Interface (WSGI)
来源:互联网 发布:手机桌面控制软件 编辑:程序博客网 时间:2024/06/18 11:43
The Web Server Gateway Interface (WSGI) is a specification for simple and universal interface between web servers and web applications or frameworks for the Python programming language.
注: WSGI是为 python 语言定义的 Web 服务器和 Web 应用程序或框架之间的一种简单而通用的接口。
It was originally specified in PEP 333 authored by Phillip J. Ebay, and published on 7 December 2003. It has since been adopted as a standard for Python web application development. The latest version of the specification is v1.0.1, also known as PEP 3333, published on 26 September.
Background
Pyhton web frameworks had been a problem for new Python users since the choice of web framework would limit the choice of usable web servers, and vice versa. Python applications were often designed for only one of CGI, FastCGI, mod_python, or some other custom API of a specific web server.
WSGI was created as a low-level interface between web servers and web applications or frameworks to promote common ground for portable web application development.
Specification overview
The WSGI has two sides: the “server” or “gateway” side (often a web server such as Apache or Nginx), and the “application” or “framework” side (the Python scipt itself).
To process a WSGI request, the server side executes the application and provides environment information and a callback function to the application side. The application processes the request, returning the response to the server side using the callback function it was provided.
注:A callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at a given time.
Between the server and the application, there may be a WSGI middleware, which implements both sides of the API. The server receives a request from a client and forwards it to the middleware. After processing, it sends a request to the application. The application’s response is forwarded by the middleware to the server and ultimately to the client. There may be multiple middlewares forming a stack of WSGI-compliant applications.
注:WSGI 中间件实现了API的双方。对服务器来说,中间件扮演应用程序;对应用程序来说, 中间件扮演服务器。
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.
- Performing content post-processing, such as applying XSLT stylesheets.
- Web Server Gateway Interface (WSGI)
- wsgi (Python Web Server Gateway Interface) ******************
- python wsgi web server gateway interface
- Python Web Server Gateway Interface(WSGI)
- Introduction to the Python Web Server Gateway Interface (WSGI)
- Python Web Server Gateway Interface v1.0
- python之Web Server Gateway Interface
- Web server, WSGI和Web framework
- Asterisk Gateway Interface
- Common Gateway Interface(CGI)
- CGI(Common Gateway Interface)
- CGI(Common Gateway Interface)
- CGI : Common Gateway Interface
- Common Gateway Interface
- [python web]wsgi初探
- web python -- WSGI接口
- Asterisk::AGI - Simple Asterisk Gateway Interface Class
- A Primer to AGI: Asterisk Gateway Interface
- SVN使用方法
- Android中Activity四种启动模式和taskAffinity属性详解
- 最短路径生成树(c++版 Dijkstra(即时和延时))
- spring学习笔记 -- day13 基于XML的引入式整合
- 最大比合并(MRC)
- Web Server Gateway Interface (WSGI)
- 慕课笔记--[课程]React入门
- B
- iostat磁盘IO命令详解
- Lintcode 用栈实现队列
- 编写一个在1,2,…,9(顺序不能变)数字之间插入+或-或什么都不插入,使得计算结果总是100的程序,并输出所有的可能性。
- Ubuntu下安装MySQL
- 乘法表
- java实现zip压缩