CherryPy is sweet !

Some quick questions:

Are you looking for fast, fun, stable HTTP, WSGI web server?

Faster development using Python?

Object oriented ?

Do you want to run multiple HTTP servers at once (on multiple ports).

Command line options ?

Easy configuration ?

Built in caching, encoding, sessions, authorizations. static contents ?

YES“, CherryPy is sweet. 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.
You can download the latest version from here.

import cherrypy
import json

class Application(object):
    def hi(self, *args):
        if not args:
            raise cherrypy.HTTPError(400, "no args.")
        elif len(args) == 1:
            m['message'] = "Hey " + args[0]
            return json.dumps(m)
            raise cherrypy.HTTPError(400, "Something is fishy")
root = Application()

cherrypy.server.socket_host = ''
cherrypy.server.socket_port = 8080
cherrypy.quickstart(root, '/')

Save and Run the script: python

ENGINE Started monitor thread '_TimeoutMonitor'.
ENGINE Started monitor thread 'Autoreloader'.
ENGINE Serving on

Click here to see the output.(http://localhost:8080/hi/govil)

{"message": "Hey govil"}



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s