CherryPy - Vocabulary


Advertisements

There are a few important keywords which need to be defined in order to understand the working of CherryPy. The keywords and the definitions are as follows −

S.No Keyword & Definition
1.

Web Server

It is an interface dealing with the HTTP protocol. Its goal is to transform the HTTP requests to the application server so that they get the responses.

2.

Application

It is a piece of software which gathers information.

3.

Application server

It is the component holding one or more applications

4.

Web application server

It is the combination of web server and application server.

Example

The following example shows a sample code of CherryPy −

import cherrypy

class demoExample:
   def index(self):
   return "Hello World!!!"
   index.exposed = True
cherrypy.quickstart(demoExample())

Let us now understand how the code works −

  • The package named CherryPy is always imported in the specified class to ensure proper functioning.

  • In the above example, the function named index returns the parameter “Hello World!!!”.

  • The last line starts the web server and calls the specified class (here, demoExample) and returns the value mentioned in default function index.

The example code returns the following output −

Demo Example
Advertisements