当前位置: 首页>>代码示例>>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;未经允许,请勿转载。