An introduction to CherryPy, a lightweight Python web framework

CherryPy is an open source, fast, and stable python web framework that allows the developers to build the web applications. The developers can build the web applications as the way they would build the other object-oriented python programs. Many developers still haven’t heard this simple,

yet powerful framework, because it is not a complete stack with built-in support for a multi-tier architecture. The developers of CherryPy call it as pythonic framework, because it closely follows the conventions of Python.

Features

Simplicity – Developing applications is much easier than anyother frameworks. You don’t have to learn the entire framework to develop a application.
Powerful – Hence, it follows the conventions of Python, the CherryPy applications are as like as regular Python applications. You don’t need to learn a new language. If you’re a Python programmer, then CheeryPy is easy to use.
Built-in web server – It Includes its own web server to host your application. Also, you can use any other popular web servers like Apache or nginx.
It is completely free and open source.

What's the one thing every developer wants? More screens! Enhance your coding experience with an external monitor to increase screen real estate.

Installation

Make sure you have installed the most recent version of python-pip. If you didn’t install python-pip yet, use the following command.

On Debian based systems:

sudo apt-get install python-pip

On RPM based systems:

yum install python-pip

After installing python-pip, install CherryPy using the following commands with root user privileges:

pip install cherrypy

Or

easy_install cherrypy

You can verify the successful installation of CherryPy using the following command. CherryPy comes with some sample tutorials. So, you can test them as shown below.

python -m cherrypy.tutorial.tut01_helloworld

Sample Output:

[18/Oct/2014:18:09:01] ENGINE Listening for SIGHUP.
[18/Oct/2014:18:09:01] ENGINE Listening for SIGTERM.
[18/Oct/2014:18:09:01] ENGINE Listening for SIGUSR1.
[18/Oct/2014:18:09:01] ENGINE Bus STARTING
[18/Oct/2014:18:09:01] ENGINE Started monitor thread ‘_TimeoutMonitor’.
[18/Oct/2014:18:09:01] ENGINE Started monitor thread ‘Autoreloader’.
[18/Oct/2014:18:09:01] ENGINE Serving on http://127.0.0.1:8080
[18/Oct/2014:18:09:01] ENGINE Bus STARTED

Now, open your web browser, and point it to http://127.0.0.1:8080/. You’ll see the “Hello world” message in your browser. Since I don’t have GUI mode in my server, I accessed the test page using command “lynx http://127.0.0.1:8080/” from my Terminal.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Leave a Reply

Your email address will not be published. Required fields are marked *

*