0

I am using cherrypy in python script.I think I have to register a callback method from the main application so that i can stop cherrypy main process from a worker thread,but how do i kill the main process within the that process.

So i want to know how to stop cherrypy from within the main process.

2 Answers2

0

Try this.

import sys

class CherryPyApp(object):

  def default(self):
    sys.exit()
  default.exposed = True

cherrypy.quickstart(CherryPyApp())
User97693321
  • 3,336
  • 7
  • 45
  • 69
0

If your process is using CherryPy to block (via quickstart or engine.block), then you could simply call: cherrypy.engine.exit() from your page handler. That would be the cleanest option since it would properly terminate CherryPy and plugins you may have subscribed to.