Open In App

Introduction to CherryPy

Last Updated : 27 Feb, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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.

cherrypy

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):
    @cherrypy.expose
    def index(self):
        return "Hello World !"
  
if __name__ == '__main__':
   cherrypy.quickstart(Root(), '/')


Output:

cherrypy-hello-world

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


Similar Reads

Environment setup for CherryPy
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. Note: For more information, refer to Introduction
2 min read
Upload file and read its content in cherrypy python
CherryPy is a web framework of Python which provides a friendly interface to the HTTP protocol for Python developers. It is also called a web application library. It allows developers to build web applications in much the same way they would build any other object-oriented Python program. This results in smaller source code developed in less time.
3 min read
Perform addition and subtraction using CherryPy
CherryPy also known as a web application library is a Python web framework that provides a friendly interface to the HTTP protocol for Python developers. It allows developers to build web applications the same way as in traditional object-oriented Python programs. Thereby, resulting in smaller source code developed in no time. This framework is mai
2 min read
How to perform multiplication using CherryPy in Python?
CherryPy also known as a web application library is a Python web framework that provides a friendly interface to the HTTP protocol for Python developers. It allows developers to build web applications the same way as in traditional object-oriented Python programs. Thereby, resulting in smaller source code developed in no time. This framework is mai
2 min read
BootStrap Introduction and Installation
To begin Web development you may go through this article first. Grid SystemButtons, Glyphicons, TablesVertical Forms, Horizontal Forms, Inline FormsDropDowns and Responsive TabsProgress Bar and JumbotronBootstrap is a free and open-source collection of tools for creating websites and web applications. It is the most popular HTML, CSS, and JavaScrip
4 min read
Introduction to NumPy
This article will help you get acquainted with the widely used array-processing library NumPy in Python. What is NumPy? NumPy is a general-purpose array-processing package. It provides a high-performance multidimensional array object and tools for working with these arrays. It is the fundamental package for scientific computing with Python. It is o
12 min read
Introduction to React Native
If you want to build mobile apps for both Android and iOS. What should you learn? The individual native languages for each app i.e, Java for Android and Swift/Objective-C for iOS?, Actually NO. Native Android and iOS development are quite different and can be expensive – first, the language itself is quite different, and second, all the underlying
3 min read
Introduction to Simulation Modeling in Python
Simulation is imitating the operations which take place within a system to study its behavior. Analyzing and creating the model of a system to predict its performance is called simulation modeling. Simulation mimics a real-life process to determine or predict the response of the entire system. This helps to understand the dependency of each part of
4 min read
Introduction to Object Oriented Programming in JavaScript
As JavaScript is widely used in Web Development, in this article we will explore some of the Object Oriented mechanisms supported by JavaScript to get the most out of it. Some of the common interview questions in JavaScript on OOPS include: How is Object-Oriented Programming implemented in JavaScript? How does it differ from other languages? Can yo
7 min read
PHP | MySQL Database Introduction
What is MySQL? MySQL is an open-source relational database management system (RDBMS). It is the most popular database system used with PHP. MySQL is developed, distributed, and supported by Oracle Corporation. The data in a MySQL database are stored in tables which consists of columns and rows.MySQL is a database system that runs on a server.MySQL
4 min read