Subsections

2. Concepts used in CherryPy

2.1 Creation of a website

CherryPy sits between a compiler and an application server.

2.2 Handling of requests

In a server generated by CherryPy, every request from a client (for instance, a browser requesting an URL) is transformed into a call to the method of a class. The parameters sent by the client become the arguments of the function.

With CherryPy, website developers just have to implement those classes and those methods. It doesn't matter if the parameters are sent with a GET, a POST, if they're a short string or a large file that's being uploaded. They're all converted to a regular Python string and passed as an argument to the method. It's all transparent to the developer.

2.3 Programming a website

Input files for CherryPy are written using an extension to the Python language. This extension defines some special classes called CherryClass. It also defines different types of methods for those CherryClasses:

This concept of functions, masks and views used in CherryClasses is one of the main feature of CherryPy. A CherryClass can contain all the information to process some data and to display the result, making it a self-contained module that can be easily reused or sub-classed.

We've seen a few of the powerful concepts used in CherryPy. More concepts will be described later, but it's now time to create our first website...

See About this document... for information on suggesting changes.