CherryPy

Web application framework


title: "CherryPy" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["articles-with-example-python-(programming-language)-code", "free-computer-libraries", "free-software-programmed-in-python", "python-(programming-language)-web-frameworks", "software-using-the-bsd-license"] description: "Web application framework" topic_path: "technology/web" source: "https://en.wikipedia.org/wiki/CherryPy" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Web application framework ::

::data[format=table title="Infobox software"]

FieldValue
nameCherryPy
captionCherryPy library
developerCherryPy team
released
latest release version
latest release date
repo
programming languagePython
operating_systemCross-platform
genreWeb application framework
licenseBSD License
website
::

| name = CherryPy | caption = CherryPy library | developer = CherryPy team | released = | latest release version = | latest release date = | repo = | programming language = Python | operating_system = Cross-platform | genre = Web application framework | license = BSD License | website = CherryPy 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 7231.

CherryPy can be a web server itself or one can launch it via any WSGI compatible environment. It does not deal with tasks such as templating for output rendering or backend access. The framework is extensible with filters, which are called at defined points in the request/response processing.

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:

::code[lang=python] import cherrypy

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

cherrypy.quickstart(HelloWorld()) ::

Features

CherryPy implements:

  • A HTTP/1.1-compliant, WSGI thread-pooled webserver. Typically, CherryPy itself takes 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.
  • Multiple HTTP servers (e.g. ability to listen on multiple ports).
  • A plugin system 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 others. 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 syntax and configuration API for turning them on and off for a specific set of handlers.
  • A configuration system for developers and deployers . CherryPy deployments are configurable on site, on application and on controller level, through Python dictionaries, configuration files, and open file objects.
  • A complete test suite for core functionality and associated framework which can be used to test CherryPy applications.
  • Built-in profiling since v2.1, coverage and testing support.

CherryPy doesn't force you to use a specific object-relational mapper (ORM), template language or JavaScript library.

Can be used with CherryPy

  • Routes — a Python re-implementation of the Ruby on Rails's routes system for mapping URLs to controllers/actions and generating URLs.

Object-relational mappers

Templating languages

  • Mako — a template library written in Python, usable with a simple CherryPy tool.
  • Cheetah — an open source template engine and code generation tool, written in Python.
  • CherryTemplate — a templating language for CherryPy.
  • Genshi — a powerful XML templating language.
  • Jinja — a general purpose templating language. CherryPy has a tool for using Jinja templates.
  • Kid — a simple template language for XML based vocabularies written in Python. TurboGears 1.x uses CherryPy as server and Kid as frontend.

CherryPy wiki helps choosing a templating language.

Products using CherryPy

  • TurboGears — CherryPy 2.x is a main component of TurboGears 1.x.
  • Splunk Enterprise - CherryPy 3.1.2

References

References

  1. "History of CherryPy".
  2. "cherrypy / CherryPy / source / cherrypy / LICENSE.txt". BitBucket.
  3. "CherryPy — A Minimalist Python Web Framework".
  4. "CherryPy v3 WSGI server benchmark results".
  5. [https://www.cherrypy.dev/wiki/CherryPySpeed How fast is CherryPy?] {{webarchive. link. (10 February 2010)
  6. "How to set up multiple HTTP servers with CherryPy".
  7. [https://www.cherrypy.dev/wiki/CustomPlugins Custom engine plugins with CherryPy] {{webarchive. link. (3 May 2009)
  8. [https://www.cherrypy.dev/chrome/common/2.2/docs/book/chunk/ch03.html#id3467720 Configuration system of CherryPy] {{webarchive. link. (26 June 2009)
  9. [https://www.cherrypy.dev/wiki/ConfigAPI Configuration API of CherryPy] {{webarchive. link. (1 July 2009)
  10. [http://docs.turbogears.org/1.0/Configuration#id5 Short summary of configuration options]
  11. [https://www.cherrypy.dev/wiki/Testing How to test CherryPy itself] {{webarchive. link. (27 September 2009)
  12. [https://www.cherrypy.dev/wiki/WhatsNewIn21#NewProfilermodule Profiler module of CherryPy] {{webarchive. link. (9 February 2010)
  13. "How to collect and the analyse coverage data of application code with CherryPy".
  14. "A simple dispatcher tool for CherryPy that uses Routes".
  15. [http://www.turbogears.org/2.0/docs/main/DownloadInstall.html TurboGears 2.x uses CherryPy as server and SQLAlchemy as its default ORM]
  16. [http://turbogears.org/about/#components TurboGears 1.x uses CherryPy as server and SQLObject as ORM] {{webarchive. link. (22 September 2009)
  17. [http://www.aminus.net/dejavu Dejavu] {{webarchive. link. (17 May 2009)
  18. [http://www.makotemplates.org/ Mako]
  19. "A simple CherryPy tool for Mako templating".
  20. "CherryPy – Genshi".
  21. "Genshi - CherryPy Tools - Trac".
  22. "A basic CherryPy Tool for using Jinja templates".
  23. [http://turbogears.org/about/#components TurboGears 1.x uses CherryPy as server and Kid as frontend] {{webarchive. link. (22 September 2009)
  24. [https://www.cherrypy.dev/wiki/ChoosingATemplatingLanguage CherryPy wiki about choosing a templating language] {{webarchive. link. (10 February 2010)
  25. "CherryPy - Splunk Knowledgebase".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

articles-with-example-python-(programming-language)-codefree-computer-librariesfree-software-programmed-in-pythonpython-(programming-language)-web-frameworkssoftware-using-the-bsd-license