示例#1
0
def initialize_wsgi_app(show_deprecated=False):
    i18n.install('watcher')

    service.prepare_service(sys.argv)

    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, log.DEBUG)

    if show_deprecated:
        LOG.warning("Using watcher/api/app.wsgi is deprecated and it will "
                    "be removed in U release. Please use automatically "
                    "generated watcher-api-wsgi instead.")

    return app.VersionSelectorApplication()
示例#2
0
    def __init__(self, service_name, use_ssl=False):
        """Initialize, but do not start the WSGI server.

        :param service_name: The service name of the WSGI server.
        :param use_ssl: Wraps the socket in an SSL context if True.
        """
        self.service_name = service_name
        self.app = app.VersionSelectorApplication()
        self.workers = (CONF.api.workers or
                        processutils.get_worker_count())
        self.server = wsgi.Server(CONF, self.service_name, self.app,
                                  host=CONF.api.host,
                                  port=CONF.api.port,
                                  use_ssl=use_ssl,
                                  logger_name=self.service_name)