中国最二的分享平台 ...


Cherrypy 是什么?美味的樱桃!

发布时间:2010-06-27 10:17:42, 关注:+6794, 赞美:+7, 不爽:+7

本文标签: cherrypy web.py

很早,很早的时候,就有了 Cherrypy。但是应用却并不广泛,无妨,许多人仍然会提起他的优异!web.py 就内置了 Cherrypy,还有 TG,还有 webfaction 的管理后台就是用 Cherrypy 做的。但是也因为他太基础,提供得太少,仅被其他框架作为基础 HTTP 服务来看待。


  • A fast, HTTP/1.1-compliant, WSGI thread-pooled webserver. Typically, CherryPy itself takes only 1-2ms per page!
  • Support for any other WSGI-enabled webserver or adapter, including Apache, IIS, lighttpd, mod_python, FastCGI, SCGI, and mod_wsgi
  • 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
  • A native mod_python adapter
  • A complete test suite
  • Swappable and customizable...everything.
  • Built-in profiling, coverage, and testing support.

直接看 Hello world 比较实在,对吧?

import cherrypy

class HelloWorld(object):
    def index(self):
        return "Hello World!"
    index.exposed = True


其实,Cherrypy 的性能也十分不错,见这里:http://cherrypy.org/wiki/CherryPySpeed,自带的 server 能跑500+请求。

如果你觉得本站对你有帮助,欢迎向本站赞助 :P


Copyright© Python4cn(news, jobs) simple-is-better.com, 技术驱动:powered by web.py 空间主机:Webfaction

版权申明:文章转载已注明出处,如有疑问请来信咨询。本站为 python 语言推广公益网站,与 python 官方没有任何关系。

联系/投搞/留言: en.simple.is.better@gmail.com 向本站捐赠