基于Python的Web框架:CherryPy
CherryPy是一個基于Python的面向對象的HTTP框架。使用CherryPy來開發Web Application是非常輕松的。但CherryPy并沒用提供一種類似于PHP的templating語言機制。
CherryPy自身內置了一個HTTP服務器,或者稱為Web服務器。這樣,對于CherryPy的用戶來說,不用另外搭設Web服務器就能直接運行 CherryPy應用程序了。實際上,Web服務器是到達CherryPy應用程序的關口,是所有的HTTP請求和響應的必經之地。因此,可以這樣理解 CherryPy內建的Web服務器:它是位于處理客戶端與服務器端之間的一層軟件,用于把底層TCP套按字傳輸的信息轉換成Http請求,并傳遞給相應 的處理程序;同時,還把上層軟件傳來的信息打包成Http響應,并向下傳遞給底層的TCP套按字。
功能特性:
- A fast, HTTP/1.1-compliant, WSGI thread-pooled webserver.
- Easy to run multiple HTTP servers (e.g. on multiple ports) at once.
- A powerful configuration system for developers and deployers alike.
- A flexible plugin system.
- Built-in tools for caching, encoding, sessions, authorization, static content, and many more.
- Swappable and customizable...everything.
- Built-in profiling, coverage, and testing support.
- Runs on Python 2.5+, 3.1+, PyPy, Jython and Android.
import cherrypy class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorld())
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!