Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1120

Show
Ignore:
Timestamp:
06/04/06 23:00:57
Author:
fumanchu
Message:

New cherrypy.quickstart function.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/__init__.py

    r1115 r1120  
    171171    logfunc(msg, context, severity) 
    172172 
     173 
     174def quickstart(root, script_name="", conf=None): 
     175    """Mount the given app, start the engine and builtin server, then block.""" 
     176    tree.mount(root, script_name, conf) 
     177    server.start() 
     178    engine.start() 
     179 
  • trunk/cherrypy/tutorial/tut01_helloworld.py

    r1110 r1120  
    2222    index.exposed = True 
    2323 
    24 # CherryPy always starts with app.root when trying to map request URIs 
    25 # to objects, so we need to mount a request handler object here. A request 
    26 # to '/' will be mapped to HelloWorld().index(). 
    27 cherrypy.tree.mount(HelloWorld()) 
    2824 
    2925if __name__ == '__main__': 
    3026    import os.path 
    31     # Start the CherryPy server. 
    32     cherrypy.config.update(os.path.join(os.path.dirname(__file__), 'tutorial.conf')) 
    33     cherrypy.server.start() 
    34     cherrypy.engine.start() 
    35  
     27    tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 
     28    cherrypy.config.update(tutconf) 
     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()) 
     33else: 
     34    # This branch is for the test suite; you can ignore it. 
     35    cherrypy.tree.mount(HelloWorld()) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets