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 9 1012 13 """ Sample request handler class. """ 1425 26 27 import os.path 28 tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 29 30 if __name__ == '__main__': 31 # CherryPy always starts with app.root when trying to map request URIs 32 # to objects, so we need to mount a request handler root. A request 33 # to '/' will be mapped to HelloWorld().index(). 34 cherrypy.quickstart(HelloWorld(), config=tutconf) 35 else: 36 # This branch is for the test suite; you can ignore it. 37 cherrypy.tree.mount(HelloWorld(), config=tutconf) 3816 # CherryPy will call this method for the root URI ("/") and send 17 # its return value to the client. Because this is tutorial 18 # lesson number 01, we'll just send something really simple. 19 # How about... 20 return "Hello world!"21 22 # Expose the index method through the web. CherryPy will never 23 # publish methods that don't have the exposed attribute set to True. 24 index.exposed = True
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jan 13 06:16:22 2016 | http://epydoc.sourceforge.net |