Skip to content
Related Articles

Related Articles

Introduction to CherryPy

View Discussion
Improve Article
Save Article
  • Last Updated : 27 Feb, 2020
View Discussion
Improve Article
Save Article

CherryPy is a popular framework of Python. Using CherryPy, web applications can be built in a faster and more reliable way. It is also called a web application library. It is known for its simplicity as it is based on object-oriented Python programming, resulting in smaller source code in less time. It is one of the oldest frameworks of Python, the very first version being released in June 2002. This framework is mainly for the developers who want to create portable database-driven web application using Python, as it provides Create, Retrieve, Update and Delete functionalities.


Note: Before proceeding with CherryPy, you should have a good understanding of Model-view-controller and Object-Oriented-Programming.

Why CherryPy?

As we know, Object-Oriented-Programming in itself has many advantages. The Extensive Support Libraries in Python and its Open Source and Community Development along with OOP gives a strong base to CherryPy.

  1. Simplicity: The complexity is reduced as the software object model objects and hence the code structure is very legible.
  2. Modular: Each object forms a separate entity whose internal workings are decoupled from other parts of the system. This enables us to consistently improve our solutions and it leads to efficiency in development through reuse.
  3. Modifiability: Minor changes can be easily made as changes inside a class do not affect any other part of a program.
  4. Extensibility: New objects can be introduced and existing ones can be modified to add new features or update existing ones.
  5. Data Re-usability: The objects can be used in other programs.
  6. Data Redundancy: Inheritance can be applied if you need a same functionality in multiple class.
  7. Data hiding: Implementation details are hidden from other modules and other modules has a clearly defined interface.
  8. Security: Using data hiding and abstraction we are providing necessary data only it mean we are maintaining security.
  9. Open Source: It is a community-maintained, open-source project hosted at Github.
  10. Deployment: It binds HTTP protocol into an API and includes its own production-ready HTTP server for hosting applications in a cost effective manner.

The project founder, Remi Delon wished to make CherryPy as Pythonic as possible so that the developer can use the framework as any regular Python module.

Take a look at the most basic application, a “Hello World” program with CherryPy:

import cherrypy
class Root(object):
    def index(self):
        return "Hello World !"
if __name__ == '__main__':
   cherrypy.quickstart(Root(), '/')



CherryPy takes an HTTP request and locates the most appropriate Python function or method that matches the request’s URL.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!