- CherryPy
-
CherryPy Developer(s) CherryPy team Stable release 3.2.0 / February 25, 2011 Written in Python Operating system Cross-platform Type Web application framework License BSD License Website homepage
mailing listCherryPy is an object-oriented web application framework using the Python programming language. It is designed for rapid development of web applications by wrapping the HTTP protocol but stays at a low level and does not offer much more than what is defined in RFC 2616.
CherryPy can be a web server itself or one can launch it via any WSGI compatible environment (including Apache 2). It does not deal with tasks such as templating for output rendering, backend access, authentication protocols. The framework is extensible with filters, simple interfaces made of seven functions. These are called at defined points in the request/response processing.
Contents
Pythonic interface
One of the goals of the project founder, Remi Delon, was to make CherryPy as pythonic as possible. This allows the developer to use the framework as any regular Python module and to forget (from a technical point of view) that the application is for the web.
For instance, the common Hello World program with CherryPy 3 would look like:
import cherrypy class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True cherrypy.quickstart(HelloWorld())
Features [1]
- A fast, HTTP/1.1-compliant, WSGI thread-pooled webserver. Typically, CherryPy itself takes [1][2] only 1-2 ms per page.
- Support for any other WSGI-enabled web server or adapter, including Apache, IIS, lighttpd, mod_python, FastCGI, SCGI, and mod_wsgi.
- A native mod_python adapter.
- Easy to run multiple HTTP servers (e.g. on multiple ports) at once [3].
- A flexible plugin system [4]. CherryPy plugins hook into events within the server process — into server startup, server shutdown, server exiting, etc. — to run code that needs to be run when the server starts up or shuts down.
- Built-in tools for caching, encoding, sessions, authorization, static content, and many more. CherryPy tools hook into events within the request process. Whenever the CherryPy server receives a request, there is a specific set of steps it goes through to handle that request. Page handlers are only one step in the process. Tools also provide a very powerful syntax and configuration API for turning them on and off for a specific set of handlers.
- A powerful configuration system for developers and deployers alike [5][6][7]. CherryPy deployments are configurable on site, on application and on controller level, through Python dictionaries, configuration files, and open file objects.
- Swappable and customizable every component [2].
- A complete test suite [8]:
- Lots of tests for both basic and advanced functionality.
- Command-line options to control which tests are run, and the output they produce.
- Debugging tools specifically for web page tests.
- Many of the test suite components are reusable by applications.
- Built-in profiling since v2.1 [9], coverage [10] and testing support.
Applications
Some open source connection
CherryPy doesn’t force you to use a specific object-relational mapper, template language or JavaScript library. You are free to use any kind of technology you want.
Can be used with CherryPy
- Routes [11] — a Python re-implementation of the Ruby on Rails's routes system for mapping URLs to controllers/actions and generating URLs.
Object-relational mappers
- SQLAlchemy — a database backend and ORM for Python applications. TurboGears 2.x uses CherryPy as server and SQLAlchemy as its default ORM [12].
- SQLObject — a popular ORM for providing an object interface to your database. Supports a number of common database backends: included in the distribution are MySQL, PostgreSQL, SQLite, Sybase SQL Server, MaxDB, Microsoft SQL Server and Firebird. TurboGears 1.x uses CherryPy as server and SQLObject as ORM [13].
- Storm — the ORM from Canonical Ltd. (makers of Ubuntu).
- Dejavu — a public domain, thread-safe ORM for Python applications.
Templating languages
- Mako — a template library written in Python, usable with a simple CherryPy tool [14].
- Cheetah — an open source template engine and code generation tool, written in Python.
- CherryTemplate — a templating language for CherryPy.
- Genshi [15][16] — a powerful XML templating language.
- Jinja — a general purpose templating language. CherryPy has a tool for using Jinja templates [17].
- Kid — a simple template language for XML based vocabularies written in Python. TurboGears 1.x uses CherryPy as server and Kid as frontend [18].
CherryPy wiki helps [19] choosing a templating language.
JavaScript libraries
- Sarissa[3] — a cross-browser library for Ajax.
- jQuery — a lightweight library that emphasizes interaction between JavaScript and HTML.
- Pyjamas — a Python to JavaScript compiler and a web widget set.
CherryPy is a component of
- TurboGears — CherryPy is a main component of TurboGears 1.x.
Further reading
- CherryPy Essentials: Rapid Python Web Application Development, First Edition (March 2007), ISBN 978-1-904811-84-8
References
External links
Notes
- ^ CherryPy v3 WSGI server benchmark results
- ^ How fast is CherryPy?
- ^ How to setup multiple HTTP servers with CherryPy
- ^ Custom engine plugins with CherryPy
- ^ Configuration system of CherryPy
- ^ Configuration API of CherryPy
- ^ Short summary of configuration options
- ^ How to test CherryPy itself
- ^ Profiler module of CherryPy
- ^ How to collect and the analyse coverage data of application code with CherryPy
- ^ A simple dispatcher tool for CherryPy that uses Routes
- ^ TurboGears 2.x uses CherryPy as server and SQLAlchemy as its default ORM
- ^ TurboGears 1.x uses CherryPy as server and SQLObject as ORM
- ^ A simple CherryPy tool for Mako templating
- ^ "CherryPy – Genshi". http://genshi.edgewall.org/wiki/CherryPy. Retrieved 2009-09-26.
- ^ "Genshi - CherryPy Tools - Trac". http://tools.cherrypy.org/wiki/Genshi. Retrieved 2009-09-26.
- ^ A basic CherryPy Tool for using Jinja templates
- ^ TurboGears 1.x uses CherryPy as server and Kid as frontend
- ^ CherryPy wiki about choosing a templating language
Python web application frameworks Django · Flask · Nevow · Pyjamas · Pylons · Spyce · TurboGears · TwistedWeb · Webware · web2py · Zope · more...Web application frameworks ASP.NET ASP.NET MVC · ASP.NET Web Forms · ASP.NET Dynamic Data · BFC · DotNetNuke · MonoRail · OpenRasta · UmbracoColdFusion Common Lisp C++ Java Apache Struts · AppFuse · Flexive · GWT · Grails · Vaadin · ItsNat · JavaServer Faces · Jspx · Makumba · OpenXava · Play · Eclipse RAP · Reasonable Server Faces · RIFE · Seam · Spring · Stripes · Tapestry · WebWork · Wicket · ZK · ICEfaces · WaveMakerJavaScript Ample SDK · Prototype JavaScript Framework · Rico · script.aculo.us · SproutCore · jQuery · Dojo ToolkitPerl PHP AppFlower · CakePHP · CodeIgniter · Drupal · e107 · Horde · Joomla! · Lithium · Midgard · MODx · Qcodo · Seagull · SilverStripe · Symfony · TYPO3 · Xaraya · Yii · Zend Framework · Zeta ComponentsPython Ruby Smalltalk Other languages Application Express (PL/SQL) · Fusebox (ColdFusion and PHP) · HAppS (Haskell) · Kepler (Lua) · Lift (Scala) · OpenACS (Tcl) · SproutCore (JavaScript/Ruby) · Yaws (Erlang)Categories:- Free development toolkits and libraries
- Python web application frameworks
Wikimedia Foundation. 2010.