4

As title, I am following the tutorial of cherrypy 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 cherrypy server.

I read from http://www.packtpub.com/article/overview-cherrypy-a-web-application-server-2 that there is an autoreload module that skip the restarting process but I don't know how to implement it.

Can anyone help?

lokheart
  • 23,743
  • 39
  • 98
  • 169

1 Answers1

3

I found it in 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())

It works but the cherrypy server script cannot be run from ipython notebook.

lokheart
  • 23,743
  • 39
  • 98
  • 169
  • +1, and of course `'engine.autoreload_on': True`, for those who want to have the autoreload engine turned on. – flaudre Mar 30 '15 at 10:39
  • 5
    Use of engine.autoreload_on is deprecated and will be removed in a future version. Use engine.autoreload.on instead. – flaudre Apr 24 '15 at 08:54