The Wayback Machine - https://web.archive.org/web/20241128103136/https://www.geeksforgeeks.org/introduction-to-cherrypy/
Open In App

Introduction to CherryPy

Last Updated : 27 Feb, 2020
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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.



Previous Article
Next Article

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
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
Introduction to Tensor with Tensorflow
TensorFlow is an open-source software library for dataflow programming across a range of tasks. It is a symbolic math library, and also used for machine learning applications such as neural networks. Google open-sourced TensorFlow in November 2015. Since then, TensorFlow has become the most starred machine learning repository on Github. (https://gi
8 min read
Django Introduction | Set 2 (Creating a Project)
Note- This article is in continuation of Django introduction. Popularity of Django Django is used in many popular sites like as: Disqus, Instagram, Knight Foundation, MacArthur Foundation, Mozilla, National Geographic etc. There are more than 5k online sites based on Django framework. ( Source ) Sites like Hot Frameworks assess the popularity of a
3 min read
Introduction to Kivy ; A Cross-platform Python Framework
Kivy is an open-source, cross-platform Python framework used for developing multi-touch applications with a natural user interface. It allows developers to build applications that run on multiple platforms, including Windows, macOS, Linux, iOS, and Android. Kivy is based on the Model-View-Controller (MVC) architecture and uses a declarative languag
4 min read
Introduction to Xamarin | A Software for Mobile App Development and App Creation
The entire world is now surrounded by billions and trillions of mobile Tech which is inevitable. The major share of the development of mobile apps is taken by the Google's Android, Apple's iOS, and Microsoft's Windows. Every new learner or newbie in Mobile Development Domain finds himself in the dilemma of choosing the platform to start with. They
9 min read
WebGL Introduction
Creating interactive media content for the web traditionally required third-party apps or plug-ins installed in browsers. With the rise of open web standards and the need to support native graphics capabilities in the web browsers, WebGL was born to bring cross-browser compatibility and to be fully integrated with web standards. What is WebGL? WebG
4 min read
Introduction to Web Development and the Holy Trinity of it
Introduction and Holy Trinity of Web Development This article will give you an overview of the Front End Development, Back-End Development, and the Full Stack Development and will give you an idea about each of them in detail so that you can decide your field of interest for yourself. Starting from the basic book definition, ‘Web development refers
12 min read
Java | MIDI Introduction
Introduction: Java MIDI is a set of Java APIs for handling musical data and MIDI (Musical Instrument Digital Interface) devices. These APIs allow Java programs to access and manipulate MIDI data, and can be used to create applications such as music players, synthesizers, and more. The Java Sound API, which includes the MIDI package, provides a low-
8 min read
Prolog | An Introduction
Introduction : Prolog is a logic programming language. It has important role in artificial intelligence. Unlike many other programming languages, Prolog is intended primarily as a declarative programming language. In prolog, logic is expressed as relations (called as Facts and Rules). Core heart of prolog lies at the logic being applied. Formulatio
3 min read
Ajax Introduction
Introduction: The following tutorial will provide a short introduction to Ajax and its uses. Before understanding these terms see few practical examples to demonstrate the power of Ajax. Facebook, Instagram, Twitter etc are considered the situation when check news feed and if like someone post simply click the like button and the like count is adde
7 min read
Introduction to Programming Languages
Introduction: A programming language is a set of instructions and syntax used to create software programs. Some of the key features of programming languages include: Syntax: The specific rules and structure used to write code in a programming language.Data Types: The type of values that can be stored in a program, such as numbers, strings, and bool
13 min read
Introduction to JavaScript Course - Learn how to build a task tracker using JavaScript
This is an introductory course about JavaScript that will help you learn about the basics of javascript, to begin with, the dynamic part of web development. You will learn the basics like understanding code structures, loops, objects, etc. What this course is about? In this course we will teach you about the basics of the scripting language i.e) Ja
4 min read
Introduction to Scripting Languages
All scripting languages are programming languages. The scripting language is basically a language where instructions are written for a run time environment. They do not require the compilation step and are rather interpreted. It brings new functions to applications and glue complex system together. A scripting language is a programming language des
3 min read
p5.js Introduction
p5.js is a JavaScript library used for creative coding. It is based on Processing which is a creative coding environment. The main focus of processing is to make it easy as possible for beginners to learn how to program interactive, graphical applications, to make a programming language more user-friendly by visualizing it. The advantage of using t
2 min read
Introduction to Go Programming
Go (also referred as Golang) is a procedural and statically-typed programming language having syntax similar to C language. It provides a rich standard library, garbage collection, and dynamic-typing capability. This language also has key-value maps, length arrays features which are advance level built-in types. Go is the most powerful, performant,
5 min read
PHP | Spreadsheet_Excel_Writer | Introduction
Introduction: Spreadsheet_Excel_Writer is a library written in PHP which helps to read from and write to different types of spreadsheet file formats with the help of given set of classes. Advantages: Easy and effective comparisons. Powerful analysis of large amounts of data. Splitting out large (or not so large) amounts of information in the form o
1 min read
Introduction to WebRTC
WebRTC stands for Web Real-Time Communication. It is an open source and free project that used to provide real-time communication to mobile applications and web browsers with the help of API's(Application Programming Interface). This project emerged as a new standard which extends the web-browsing model by enabling the browser in a peer-to-peer man
5 min read
Meteor Introduction and Environment Setup
Meteor is an open-source full-stack JavaScript platform that is useful for developing modern web and mobile applications. Meteor helps the developer to develop in one language. Meteor has several features that help for creating a responsive and reactive web or mobile application using JavaScript or different packages available in the framework. For
2 min read
Introduction to pygame
Game programming is very rewarding nowadays and it can also be used in advertising and as a teaching tool too. Game development includes mathematics, logic, physics, AI, and much more and it can be amazingly fun. In python, game programming is done in pygame and it is one of the best modules for doing so. Installing pygame: Pygame requires Python;
5 min read
Data Classes in Python | An Introduction
dataclass module is introduced in Python 3.7 as a utility tool to make structured classes specially for storing data. These classes hold certain properties and functions to deal specifically with the data and its representation.DataClasses in widely used Python3.6 Although the module was introduced in Python3.7, one can also use it in Python3.6 by
3 min read
HTML5 | Introduction
Introduction: HTML stands for Hyper Text Markup Language. It is used to design web pages using a markup language. HTML is an abbreviation of Hypertext and Markup language. Hypertext defines the link between the web pages. The markup language is used to define the text document within the tag which defines the structure of web pages. HTML 5 is the f
6 min read
Introduction about Node.js and MongoDB
NoSQL databases are databases that store and retrieve the data that is present in a non-tabular format. Depending on the format of the data stored, NoSQL databases are split into 4 major types: Key-Value Graph database Document-oriented Column family These databases are built to address the shortcomings of traditional RDBMS and provide high perform
4 min read
Python | wxPython module Introduction
Python provides wxpython module which allows us to create high functional graphical user interface. It is an Open Source module, which means it is free for anyone to use and the source code is available for anyone to look and modify. It is implemented as a set of extension modules that wrap the GUI components of wxWidgets library which is written i
3 min read
Introduction to Express
Prerequisite - Node.js What is Express? Express is a small framework that sits on top of Node.js's web server functionality to simplify its APIs and add helpful new features.It makes it easier to organize your application's functionality with middle ware and routing; it adds helpful utilities to Node.js's HTTP objects;it facilitates the rendering o
2 min read
three90RightbarBannerImg