Пример #1
0
    def __init__(self):
        """
        Initialize the management daemon.
        """
        GeventDaemon.__init__(self)

        # WSGI configuration from /etc/<name>.conf
        host = self.config("server", "host", "0.0.0.0", str)
        port = self.config("server", "port", 80, int)

        # Set up logging
        log_level = self.config("logging", "level", 10, int)
        self.logger.setLevel(log_level)

        # Create WSGI server
        self.application = WsgiApplication(self.logger, self.config)
Пример #2
0
    def __init__(self):
        """
        Initialize the management daemon.
        """
        GeventDaemon.__init__(self)

        # WSGI configuration from daemon config
        host = self.config("wsgi-server", "host", "0.0.0.0", str)
        port = self.config("wsgi-server", "port", 80, int)
        debug = self.config("wsgi-server", "debug", True, bool)

        # Get reference to the database we're using
        base = self.config("storage", "base", "/srv/imagerack", str)
        self.img_path = "%s/%s" % (base, self.config("storage", "img", "images", str))
        self.web_path = "%s/%s" % (base,  self.config("storage", "web", "web", str))

        # Create WSGI server
        self.server = pywsgi.WSGIServer((host, port))
        self.server.application = WsgiHandler(self.logger, self.img_path, self.web_path)