Home | Trees | Indices | Help |
|
---|
|
1 """ 2 Tutorial - Hello World 3 4 The most basic (working) CherryPy application possible. 5 """ 6 7 # Import CherryPy global namespace 8 import cherrypy 911 """ Sample request handler class. """ 1223 24 25 import os.path 26 tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 27 28 if __name__ == '__main__': 29 # CherryPy always starts with app.root when trying to map request URIs 30 # to objects, so we need to mount a request handler root. A request 31 # to '/' will be mapped to HelloWorld().index(). 32 cherrypy.quickstart(HelloWorld(), config=tutconf) 33 else: 34 # This branch is for the test suite; you can ignore it. 35 cherrypy.tree.mount(HelloWorld(), config=tutconf) 3614 # CherryPy will call this method for the root URI ("/") and send 15 # its return value to the client. Because this is tutorial 16 # lesson number 01, we'll just send something really simple. 17 # How about... 18 return "Hello world!"19 20 # Expose the index method through the web. CherryPy will never 21 # publish methods that don't have the exposed attribute set to True. 22 index.exposed = True
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Mar 16 17:19:59 2014 | http://epydoc.sourceforge.net |