Search code examples
pythoncherrypykill-process

How to kill the cherrypy process?


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.


Solution

  • Try this.

    import sys
    
    class CherryPyApp(object):
    
      def default(self):
        sys.exit()
      default.exposed = True
    
    cherrypy.quickstart(CherryPyApp())