HOME

TheInfoList



OR:

CherryPy is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
web application framework A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build and ...
using the
Python programming language Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically-typed and garbage-collected. It supports multiple programming p ...
. It is designed for rapid development of
web application A web application (or web app) is application software that is accessed using a web browser. Web applications are delivered on the World Wide Web to users with an active network connection. History In earlier computing models like client-serve ...
s by
wrapping Wrapping may refer to: *Buddy wrapping, the act of bandaging a damaged (particularly a fractured) finger or toe together with a healthy one *Overwrap, a wrapping of items in a package of a wrapping over packaging *Wrapping (graphics), the process ...
the
HTTP protocol The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, w ...
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 The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, v ...
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 The Remi (Gaulish: ''RÄ“mi'', 'the first, the princes') were a Belgic tribe dwelling in the Aisne, Vesle and Suippe river valleys during the Iron Age and the Roman period. Their territory roughly corresponded the modern Marne and Ardennes and p ...
, 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 ''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the ''Norwich C ...
program with CherryPy 3 would look like: 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 The Web Server Gateway Interface (WSGI, pronounced ''whiskey'' or ) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the Python programming language. The current version of WSGI, v ...
thread-pooled webserver. Typically, CherryPy itself takes only 1–2 ms per page. * Support for any other WSGI-enabled
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiate ...
or adapter, including
Apache The Apache () are a group of culturally related Native American tribes in the Southwestern United States, which include the Chiricahua, Jicarilla, Lipan, Mescalero, Mimbreño, Ndendahe (Bedonkohe or Mogollon and Nednhi or Carrizaleño an ...
, IIS,
lighttpd lighttpd (pronounced "lighty") is an open-source web server optimized for speed-critical environments while remaining standards-compliant, secure and flexible. It was originally written by Jan Kneschke as a proof-of-concept of the c10k problem †...
,
mod_python mod_python is an Apache HTTP Server module that integrates the Python programming language with the server. It is intended to provide a Python language binding for the Apache HTTP Server. When mod_python released it was one of the more efficient ...
,
FastCGI FastCGI is a binary protocol A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, s ...
,
SCGI The Simple Common Gateway Interface (SCGI) is a protocol for applications to interface with HTTP servers, as an alternative to the CGI protocol. It is similar to FastCGI but is designed to be easier to parse. Unlike CGI, it permits a long-running ...
, and
mod_wsgi mod_wsgi is an Apache HTTP Server module by Graham Dumpleton that provides a WSGI compliant interface for hosting Python based web applications under Apache. As of version 4.5.3, mod_wsgi supports Python 2 and 3 (starting from 2.6 and 3.2). It i ...
. * A native
mod_python mod_python is an Apache HTTP Server module that integrates the Python programming language with the server. It is intended to provide a Python language binding for the Apache HTTP Server. When mod_python released it was one of the more efficient ...
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 In communications and information processing, code is a system of rules to convert information—such as a letter, word, sound, image, or gesture—into another form, sometimes shortened or secret, for communication through a communication ...
,
sessions Sessions may refer to: * Sessions (surname), a surname * Sessions (clothing company), an American apparel company * Sessions Clock Company, an American clock manufacturer in the early 20th century Arts, entertainment, and media * ''The Sessions' ...
,
authorization Authorization or authorisation (see spelling differences) is the function of specifying access rights/privileges to resources, which is related to general information security and computer security, and to access control in particular. More for ...
, 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 In software development, a test suite, less commonly known as a validation suite, is a collection of test cases that are intended to be used to test a software program to show that it has some specified set of behaviors. A test suite often contai ...
for core functionality and associated framework which can be used to test CherryPy applications. * Built-in profiling since v2.1,
coverage Coverage may refer to: Filmmaking * Coverage (lens), the size of the image a lens can produce * Camera coverage, the amount of footage shot and different camera setups used in filming a scene * Script coverage, a short summary of a script, wri ...
and testing support. CherryPy doesn't force you to use a specific object-relational mapper (ORM),
template language A template processor (also known as a template engine or template parser) is software designed to combine templates with a data model to produce result documents. The language that the templates are written in is known as a template language ...
or
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies. Libraries With the expanded demands for JavaScript, an ea ...
.


Can be used with CherryPy

* Routes — a Python re-implementation of the
Ruby on Rails Ruby on Rails (simplified as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web p ...
's routes system for mapping
URL A Uniform Resource Locator (URL), colloquially termed as a web address, is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifie ...
s to controllers/actions and generating URLs.


Object-relational mappers

*
SQLAlchemy SQLAlchemy is an open-source SQL toolkit and object-relational mapper (ORM) for the Python programming language released under the MIT License. Description SQLAlchemy's philosophy is that relational databases behave less like object collectio ...
— a database backend and
ORM Orm (in Old Norse and in modern Danish, Swedish, Norwegian (bokmål and nynorsk) the word for "snake", "worm" or "dragon") became an Anglo-Saxon personal name during period of the Danelaw. Orm may also refer to: * Orm or Ormin, the author of ...
for Python applications.
TurboGears TurboGears is a Python web application framework consisting of several WSGI components such as WebOb, SQLAlchemyKajikitemplate language and Repoze. TurboGears is designed around the model–view–controller (MVC) architecture, much like Struts ...
2.x uses CherryPy as server and SQLAlchemy as its default ORM. *
SQLObject SQLObject is a Python object-relational mapper between a SQL database and Python objects. It is experiencing community popularity, and forms a part of many applications (e.g., TurboGears). It is very similar to Ruby on Rails' ActiveRecord in oper ...
— a popular
ORM Orm (in Old Norse and in modern Danish, Swedish, Norwegian (bokmål and nynorsk) the word for "snake", "worm" or "dragon") became an Anglo-Saxon personal name during period of the Danelaw. Orm may also refer to: * Orm or Ormin, the author of ...
for providing an object interface to a database. Supports a number of common database backends: included in the distribution are
MySQL MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database o ...
,
PostgreSQL PostgreSQL (, ), also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance. It was originally named POSTGRES, referring to its origins as a successor to the In ...
,
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the most ...
,
Sybase SQL Server SAP ASE (Adaptive Server Enterprise), originally known as Sybase SQL Server, and also commonly known as Sybase DB or Sybase ASE, is a relational model database server developed by Sybase Corporation, which later became part of SAP AG. ASE was ...
,
MaxDB MaxDB is an ANSI SQL-92 (entry level) compliant relational database management system ( RDBMS) from SAP AG, which was also delivered by MySQL AB from 2003 to 2007. MaxDB is targeted for large SAP environments e.g. mySAP Business Suite, and othe ...
,
Microsoft SQL Server Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applications—which ma ...
and
Firebird Firebird and fire bird may refer to: Mythical birds * Phoenix (mythology), sacred firebird found in the mythologies of many cultures * Bennu, Egyptian firebird * Huma bird, Persian firebird * Firebird (Slavic folklore) Bird species ''Various sp ...
. TurboGears 1.x uses CherryPy as server and SQLObject as ORM. *
Storm A storm is any disturbed state of the natural environment or the atmosphere An atmosphere () is a layer of gas or layers of gases that envelop a planet, and is held in place by the gravity of the planetary body. A planet retains an atmos ...
— the
ORM Orm (in Old Norse and in modern Danish, Swedish, Norwegian (bokmål and nynorsk) the word for "snake", "worm" or "dragon") became an Anglo-Saxon personal name during period of the Danelaw. Orm may also refer to: * Orm or Ormin, the author of ...
from
Canonical Ltd. Canonical Ltd. is a UK-based privately held computer software company founded and funded by South African entrepreneur Mark Shuttleworth to market commercial support and related services for Ubuntu and related projects. Canonical employs staff ...
(makers of
Ubuntu Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: ''Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All the ...
) * Dejavu — a
public domain software Public-domain software is software that has been placed in the public domain, in other words, software for which there is absolutely no ownership such as copyright, trademark, or patent. Software in the public domain can be modified, distributed, ...
, thread-safe ORM for Python applications * MongoEngine — An ODM for connecting to
MongoDB MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Serve ...
.


Templating languages

*
Mako , better known by the mononym name Mako (sometimes stylised MAKO), is a Japanese voice actress, singer and a member of the band Bon-Bon Blanco, in which her prominent role is as the maraca player. She has also performed in a Japanese television d ...
— a template library written in Python, usable with a simple CherryPy tool. *
Cheetah The cheetah (''Acinonyx jubatus'') is a large cat native to Africa and central Iran. It is the fastest land animal, estimated to be capable of running at with the fastest reliably recorded speeds being , and as such has evolved specialized ...
— 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 Kid, Kids, KIDS, and K.I.D.S. may refer to: Common meanings * Colloquial term for a child or other young person ** Also for a parent's offspring regardless of age * Engage in joking * Young goats * The goat meat of young goats * Kidskin, lea ...
— a simple template language for XML based vocabularies written in Python.
TurboGears TurboGears is a Python web application framework consisting of several WSGI components such as WebOb, SQLAlchemyKajikitemplate language and Repoze. TurboGears is designed around the model–view–controller (MVC) architecture, much like Struts ...
1.x uses CherryPy as server and Kid as frontend. CherryPy wiki helps choosing a templating language.


Products using CherryPy

*
TurboGears TurboGears is a Python web application framework consisting of several WSGI components such as WebOb, SQLAlchemyKajikitemplate language and Repoze. TurboGears is designed around the model–view–controller (MVC) architecture, much like Struts ...
— CherryPy 2.x is a main component of TurboGears 1.x. *
Splunk Splunk Inc. is an American software company based in San Francisco, California, that produces software for searching, monitoring, and analyzing machine-generated data via a Web-style interface. Its software helps capture, index and correlate ...
Enterprise - CherryPy 3.1.2


See also

*
Comparison of web frameworks Two comparisons of web frameworks are available: * Comparison of JavaScript-based web frameworks (front-end) * Comparison of server-side web frameworks This is a comparison of notable web frameworks, software used to build and deploy web applicat ...


References


External links

* {{DEFAULTSORT:Cherrypy 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