def __init__(self, site, options = defaultOptions): """ Start a web server for the site/page If another server is already running a root site, add this below the root level instead of replacing the existing root. """ self.options = options Terminal.__init__(self, "not started") Thread.__init__(self) self.root = site try: self.start () cherrypy.root = site except: print "Another server is running a root (/) site", cherrypy.root print "This", site, "is put in /" + site.__class__.__name__ setattr (cherrypy.root, site.__class__.__name__, site)
def stop(self): cherrypy.server.stop () Terminal.__init__(self, "stopped")
def run(self): Terminal.__init__(self, "http://localhost:%d" % self.options.get ('socketPort', 8080)) cherrypy.server.start (configMap = self.options)