1. Eric Larson
  2. Dad

Source

Dad / example / hello_world

#!/usr/bin/env python
import os
import cherrypy


class HelloWorld(object):
    def index(self):
        return 'Hello World!'

    index.exposed = True


def run():
    cherrypy.config.update({
        'server.socket_host': os.environ.get('HOST', '127.0.0.1'),
        'server.socket_port': int(os.environ.get('PORT', 8080)),
    })


    cherrypy.tree.mount(HelloWorld(), '/')
    cherrypy.engine.start()
    cherrypy.engine.block()


if __name__ == '__main__':
    run()