See ApplicationReference for other objects and interfaces.
Engine Object
The cherrypy.engine object is used to contain and manage all site startup and shutdown behavior. The cherrypy.quickstart function calls it for you, but if you're not using quickstart, you'll probably write:
if __name__ == '__main__': cherrypy.config.update(siteconf) cherrypy.tree.mount(Root(), '/', appconf) # Explicitly starting the server is only necessary in 3.0 and previous. # 3.1 does it for you when you call engine.start(). cherrypy.server.quickstart() cherrypy.engine.start() cherrypy.engine.block()
The start() call starts up the site; the block() calls blocks the main thread so that it can persist to handle interrupts and do other cleanup when some other thread calls engine.exit(). For example, a KeyboardInterrupt exception (Ctrl-C) may be raised in an arbitrary thread; therefore, any thread that may do so should trap it and call engine.exit().
Starting with CherryPy 3.1, cherrypy.engine is an instance of a WebSiteProcessBus, which standardizes a lot of the above. Version 3.1 also requires the autoreload event to occur in the main thread (see #581), so you either need to call engine.block(), or in some other way poll for engine.execv in your main thread.
Older versions
TODO

