Monday, September 24, 2012

Quick Setup CherryPy in Python 3

CherryPy is a minimalist, pythonic, object-oriented HTTP framework.
For Windows,
1. Download and install the latest version of python 3.
2. Download and install the latest version of CherryPy with wsgiserver3 support.
3. Test the installation by running an example program (say hello.py) like below.
import cherrypy

class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True

cherrypy.quickstart(HelloWorld())
4. Navigate to the directory and run python hello.py to start the server.
5. Now goto 127.0.0.1:8080 and we will get a "Hello World!" from the server.