Change Cherrypy Port and restart web server

williamtroup picture williamtroup · Aug 31, 2011 · Viewed 11.2k times · Source

Is there a way in python to change the port that cherrypy is using and force the web server (not apache, cherrypy) to restart?

Answer

Reto Aebersold picture Reto Aebersold · Aug 31, 2011

Have a look at cherrypy.process.servers. You can try something like this:

import cherrypy
cherrypy.config.update({'server.socket_port': 8099})
cherrypy.engine.restart()