The right way to implement Cherrypy startup module

As a headline, I follow the cherrypy tutorial at http://docs.cherrypy.org/en/latest/tutorials.html#tutorial-1-a-basic-web-application , and I want to see the changes in my script immediately without restarting my cherry server.

I read from http://www.packtpub.com/article/overview-cherrypy-a-web-application-server-2 that there is a module autoreloadthat skips the restart process, but I don’t know how to implement This.

Can anyone help?

+4
source share
1 answer

I found it at http://cherrypy.readthedocs.org/en/latest/deploy.html

import cherrypy

class Root(object):
    @cherrypy.expose
    def index(self):
        return "Hello World!"


cherrypy.config.update({'server.socket_port': 8090,
                        'engine.autoreload_on': False,
                        'log.access_file': './access.log',
                        'log.error_file': './error.log'})
cherrypy.quickstart(Root())

, script ipython.

+3

All Articles