English 中文(简体)
CherryPy - Vocabulary
  • 时间:2024-12-22

CherryPy - Vocabulary


Previous Page Next Page  

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 deapng with the HTTP protocol. Its goal is to transform the HTTP requests to the apppcation server so that they get the responses.

2.

Apppcation

It is a piece of software which gathers information.

3.

Apppcation server

It is the component holding one or more apppcations

4.

Web apppcation server

It is the combination of web server and apppcation 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 pne 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