Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cherrypy
- class HelloWorld:
- """ Sample request handler class. """
- def index(self, **params):
- # CherryPy will call this method for the root URI ("/") and send
- # its return value to the client.
- for key in params:
- print key, '=', params[key]
- return "Hello world!"
- # Expose the index method through the web. CherryPy will never
- # publish methods that don't have the exposed attribute set to True.
- index.exposed = True
- # CherryPy always starts with app.root when trying to map request URIs
- # to objects, so we need to mount a request handler root. A request
- # to '/' will be mapped to HelloWorld().index().
- cherrypy.config.update({'server.socket_host': '127.0.0.1'})
- cherrypy.config.update({'server.socket_port': 8080})
- cherrypy.quickstart(HelloWorld(), '/')
Add Comment
Please, Sign In to add comment