示例#1
0
    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)
示例#2
0
 def stop(self):
     cherrypy.server.stop ()
     Terminal.__init__(self, "stopped")
示例#3
0
 def run(self):
     Terminal.__init__(self,
         "http://localhost:%d" % self.options.get ('socketPort', 8080))
     cherrypy.server.start (configMap = self.options)