欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Twisted Web
来自开放百科 - 灰狐
(版本间的差异)
(未显示1个用户的2个中间版本) | |||
第1行: | 第1行: | ||
− | [[Image: | + | [[Image:twisted-web-overview.png|right|Twisted Web's Structure]] |
Twisted Web is a web application server written in pure Python, with APIs at multiple levels of abstraction to facilitate different kinds of web programming. | Twisted Web is a web application server written in pure Python, with APIs at multiple levels of abstraction to facilitate different kinds of web programming. | ||
When the Web Server receives a request from a Client, it creates a Request object and passes it on to the Resource system. The Resource system dispatches to the appropriate Resource object based on what path was requested by the client. The Resource is asked to render itself, and the result is returned to the client. | When the Web Server receives a request from a Client, it creates a Request object and passes it on to the Resource system. The Resource system dispatches to the appropriate Resource object based on what path was requested by the client. The Resource is asked to render itself, and the result is returned to the client. | ||
+ | #/usr/local/bin/twistd web | ||
+ | http://localhost:8080/ | ||
+ | Hello! This is a temporary test until a more sophisticated form demo can be put back in using more up-to-date Twisted APIs. | ||
+ | |||
+ | ==Main Concepts== | ||
+ | *'Site Objects' are responsible for creating HTTPChannel instances to parse the HTTP request, and begin the object lookup process. They contain the root Resource, the resource which represents the URL / on the site. | ||
+ | *'Resource' objects represent a single URL segment. The IResource interface describes the methods a Resource object must implement in order to participate in the object publishing process. | ||
+ | *'Resource trees' are arrangements of Resource objects into a Resource tree. Starting at the root Resource object, the tree of Resource objects defines the URLs which will be valid. | ||
+ | *'.rpy scripts' are python scripts which the twisted.web static file server will execute, much like a CGI. However, unlike CGI they must create a Resource object which will be rendered when the URL is visited. | ||
+ | *'Resource rendering' occurs when Twisted Web locates a leaf Resource object. A Resource can either return an html string or write to the request object. | ||
+ | *'Session' objects allow you to store information across multiple requests. Each individual browser using the system has a unique Session instance. | ||
http://twistedmatrix.com/projects/web/ | http://twistedmatrix.com/projects/web/ |
2007年2月22日 (四) 15:07的最后版本
Twisted Web is a web application server written in pure Python, with APIs at multiple levels of abstraction to facilitate different kinds of web programming.
When the Web Server receives a request from a Client, it creates a Request object and passes it on to the Resource system. The Resource system dispatches to the appropriate Resource object based on what path was requested by the client. The Resource is asked to render itself, and the result is returned to the client.
#/usr/local/bin/twistd web http://localhost:8080/
Hello! This is a temporary test until a more sophisticated form demo can be put back in using more up-to-date Twisted APIs.
[编辑] Main Concepts
- 'Site Objects' are responsible for creating HTTPChannel instances to parse the HTTP request, and begin the object lookup process. They contain the root Resource, the resource which represents the URL / on the site.
- 'Resource' objects represent a single URL segment. The IResource interface describes the methods a Resource object must implement in order to participate in the object publishing process.
- 'Resource trees' are arrangements of Resource objects into a Resource tree. Starting at the root Resource object, the tree of Resource objects defines the URLs which will be valid.
- '.rpy scripts' are python scripts which the twisted.web static file server will execute, much like a CGI. However, unlike CGI they must create a Resource object which will be rendered when the URL is visited.
- 'Resource rendering' occurs when Twisted Web locates a leaf Resource object. A Resource can either return an html string or write to the request object.
- 'Session' objects allow you to store information across multiple requests. Each individual browser using the system has a unique Session instance.
分享您的观点