當前位置: 首頁>>代碼示例>>Python>>正文


Python wsgi.WSGIServer方法代碼示例

本文整理匯總了Python中gevent.wsgi.WSGIServer方法的典型用法代碼示例。如果您正苦於以下問題:Python wsgi.WSGIServer方法的具體用法?Python wsgi.WSGIServer怎麽用?Python wsgi.WSGIServer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gevent.wsgi的用法示例。


在下文中一共展示了wsgi.WSGIServer方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _start_web

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def _start_web(port, sentry_dsn=None, blueprints=None):
  """
  Starts a Flask app with optional error logging and blueprint registration.

  Args:
    port - str/int - port on which management application should listen for
      HTTP traffic.
    sentry_dsn - str - Sentry DSN for error logging.
    blueprints - list(flask.Blueprint)- blueprints to register.
  """
  # Set up management application
  app = Flask(__name__)
  app.register_blueprint(lifecycle_blueprint)
  if blueprints:
    for blueprint in blueprints:
      app.register_blueprint(blueprint)
  if sentry_dsn:
    app = setup_sentry_wsgi(app, sentry_dsn)
  http_server = WSGIServer(('0.0.0.0', int(port)), app)
  http_server.serve_forever() 
開發者ID:tellapart,項目名稱:aurproxy,代碼行數:22,代碼來源:command.py

示例2: run

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def run(self, app): # pragma: no cover
        from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
        from wsgiref.simple_server import make_server
        import socket

        class FixedHandler(WSGIRequestHandler):
            def address_string(self): # Prevent reverse DNS lookups please.
                return self.client_address[0]
            def log_request(*args, **kw):
                if not self.quiet:
                    return WSGIRequestHandler.log_request(*args, **kw)

        handler_cls = self.options.get('handler_class', FixedHandler)
        server_cls  = self.options.get('server_class', WSGIServer)

        if ':' in self.host: # Fix wsgiref for IPv6 addresses.
            if getattr(server_cls, 'address_family') == socket.AF_INET:
                class server_cls(server_cls):
                    address_family = socket.AF_INET6

        srv = make_server(self.host, self.port, app, server_cls, handler_cls)
        srv.serve_forever() 
開發者ID:Autodesk,項目名稱:arnold-usd,代碼行數:24,代碼來源:__init__.py

示例3: launch

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def launch(app):
    http_server = WSGIServer(('', app.config['XCESSIV_PORT']), app)
    webbrowser.open_new('http://localhost:' + str(app.config['XCESSIV_PORT']))
    http_server.serve_forever() 
開發者ID:reiinakano,項目名稱:xcessiv,代碼行數:6,代碼來源:server.py

示例4: run

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def run(self, handler): # pragma: no cover
        import flup.server.fcgi
        self.options.setdefault('bindAddress', (self.host, self.port))
        flup.server.fcgi.WSGIServer(handler, **self.options).run() 
開發者ID:exiahuang,項目名稱:SalesforceXyTools,代碼行數:6,代碼來源:bottle.py

示例5: __init__

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def __init__(self, options=None):
        self.args_options = options or {}
        os.environ['APPR_DB_CLASS'] = self.args_options.db_class
        print("Listening %s:%s" % (self.args_options.bind, self.args_options.port))
        self.http_server = WSGIServer((self.args_options.bind, self.args_options.port),
                                      create_app()) 
開發者ID:app-registry,項目名稱:appr,代碼行數:8,代碼來源:gevent_app.py

示例6: _record_messages

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def _record_messages(self, on_message):
        from flask import Flask

        app = Flask(__name__)
        for component in self.listener_components:
            if self._has_root_prefix():
                app.register_blueprint(component.blueprint(on_message))
            else:
                app.register_blueprint(component.blueprint(on_message),
                                       url_prefix=self.url_prefix)

        from gevent.wsgi import WSGIServer
        http_server = WSGIServer(('0.0.0.0', self.http_port), app)
        http_server.serve_forever() 
開發者ID:Rowl1ng,項目名稱:rasa_wechat,代碼行數:16,代碼來源:rest.py

示例7: serve_forever

# 需要導入模塊: from gevent import wsgi [as 別名]
# 或者: from gevent.wsgi import WSGIServer [as 別名]
def serve_forever(self):
        debug = self.app.config.get('DEBUG', True)
        host = self.app.config.get('HOST', 'localhost')
        port = self.app.config.get('PORT', 5000)
        if not debug:
            from gevent.wsgi import WSGIServer
            http_server = WSGIServer((host, port), self.app, log=debug)
            http_server.serve_forever()
        else:
            self.app.run(host, port) 
開發者ID:whiteclover,項目名稱:white,代碼行數:12,代碼來源:server.py


注:本文中的gevent.wsgi.WSGIServer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。