Table of contents
1.
Introduction
2.
Environmental Setup for CherryPy
2.1.
Requirements
2.2.
Python Version Supported
2.3.
Installation Process
2.4.
Installation Test
2.5.
Run
2.6.
Cherryd
3.
Frequently Asked Questions
3.1.
What Exactly is CherryPy?
3.2.
Any three Prior requirements before installing CherryPy?
3.3.
What are the Commands for installing CherryPy?
3.4.
What does this -e Command indicate?
3.5.
What does this -c Command indicate?
4.
Conclusion
Last Updated: Mar 27, 2024
Easy

Environmental Setup for CherryPy

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Coders: I want to make a web application

Coding Ninja: Go Ahead, bro….

Coders: But I only have knowledge of Python, and I cannot do web development just with Python!

Coding Ninjas: Who told you this !!! Have you heard of CherryPy?

Coders: No, What is this CherryPy?

Coding Ninjas: CherryPy enables developers to create web apps in the same manner as they would any other object-oriented Python program. As a result, less source code is completed in less time.

CodersThis is very interesting; how to install and setup this CherryPy

Coding Ninjas: Well, I can tell you………..

Environmental Setup for CherryPy

Environmental Setup for CherryPy

CherryPy is a very famous Python framework. Web applications can be built or designed faster and more reliably with CherryPy. It's also known as a web application library. As it is based on object-oriented Python programming, it is noted for its simplicity, resulting in less source code in less time. 

Now we know what CherryPy is, so let's see its essential requirement for its Installation and Setup.

Requirements

CherryPy has no necessary system requirements. Pip automatically installs a Python-based distribution that is needed. Certain functions, however, will require the installation of additional packages. To make it easier to install other dependencies, cherryPy provide options to include.

  • doc – for documentation-related matters
  • json – for a personalized JSON processing library
  • routes_dispatcher – dispatcher routes for declarative URL mapping
  • ssl –  for OpenSSL bindings, helpful in Python environments where the ssl module is not installed
  • testing
  • Memcached_session – allows backend Memcached session

Python Version Supported

CherryPy works with Python 3.5 through Python 3.8.

Installation

Also see, How to Check Python Version in CMD

Installation Process

CherryPy is simple to install using the standard Python package manager;  pip or setup-tools.

Easy Install

$ easy_install cherrypy

 

Pip Install

$ pip install cherrypy

You may also obtain the most recent CherryPy version by downloading the source code from Github:

GitHub Install

$ git clone https://github.com/cherrypy/cherrypy
$ cd cherrypy
$ python setup.py install

 

Installation test

Installation Test

CherryPy includes a collection of easy tutorials that may be run once the package has been installed. 

$ python -m cherrypy.tutorial.tut01_helloworld

 

Navigate to http://127.0.0.1:8080 for output.

When run, the above program displays the following logs:

output

 

Output:

output

Run

The simplest way to run your application during development is as follows:

$ Python myapp.py

 

It will work well as long as myapp.py contains a "__main__" section.

Cherryd

The cherryd script, installed alongside CherryPy, may also be used to launch the application.

Some Common Commands:

  • -e, –environment 

 Use the specified configuration environment (defaults to None)

  • -c, –config

 Specify Config file

  •  -i, –import

 Specify modules to import

  •  -P, –path

  Add the given paths to the sys.path

  •  -d

 Apply the given config environment 

Frequently Asked Questions

What Exactly is CherryPy?

CherryPy is a very famous Python framework. Web applications can be constructed or built faster and more reliably with CherryPy. It's also known as a web application library. Because it is based on object-oriented Python programming, it is used for its simplicity, resulting in more minor source code in less time.

Any three Prior requirements before installing CherryPy?

Some of the pre-requirements are JSON, routes_dispatcher, SSL

What are the Commands for installing CherryPy?

The Command to install CherryPy is:

$ easy_install cherrypy

$ pip install cherrypy

What does this -e Command indicate?

-e indicates the use of specified configuration environment

What does this -c Command indicate?

-c indicates –config

It Specifies the Configuration file

Conclusion

In this article, we learned about Environmental Setup for CherryPy, which includes the installation Process and Test for CherryPy.

After reading about Environmental Setup for CherryPy, are you not feeling excited to read/explore more articles on the topic of Ruby? Don't worry; Coding Ninjas has you covered. See Why CherryPyDeploy in CherryPy, Multithreading in Python, Descriptors in PythonBorderLayout in Java and Namespaces in CherryPy.

Refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingJavaScriptSystem Design, and many more! 

Live masterclass