本文整理汇总了Python中gevent.wsgi方法的典型用法代码示例。如果您正苦于以下问题:Python gevent.wsgi方法的具体用法?Python gevent.wsgi怎么用?Python gevent.wsgi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gevent
的用法示例。
在下文中一共展示了gevent.wsgi方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gevent [as 别名]
# 或者: from gevent import wsgi [as 别名]
def __init__(self, app):
log.debug('initializing JSONRPCServer')
BaseService.__init__(self, app)
self.app = app
self.dispatcher = LoggingDispatcher()
# register sub dispatchers
for subdispatcher in self.subdispatcher_classes():
subdispatcher.register(self)
transport = WsgiServerTransport(queue_class=gevent.queue.Queue)
# start wsgi server as a background-greenlet
self.listen_port = app.config['jsonrpc']['listen_port']
self.listen_host = app.config['jsonrpc']['listen_host']
self.wsgi_server = gevent.wsgi.WSGIServer((self.listen_host, self.listen_port),
transport.handle, log=WSGIServerLogger)
self.rpc_server = RPCServerGreenlets(
transport,
JSONRPCProtocol(),
self.dispatcher
)
self.default_block = 'latest'
示例2: run
# 需要导入模块: import gevent [as 别名]
# 或者: from gevent import wsgi [as 别名]
def run(self, handler):
from gevent import wsgi as wsgi_fast, pywsgi, monkey, local
if self.options.get('monkey', True):
if not threading.local is local.local: monkey.patch_all()
wsgi = wsgi_fast if self.options.get('fast') else pywsgi
wsgi.WSGIServer((self.host, self.port), handler).serve_forever()
示例3: __init__
# 需要导入模块: import gevent [as 别名]
# 或者: from gevent import wsgi [as 别名]
def __init__(self, app):
log.debug('initializing JSONRPCServer')
BaseService.__init__(self, app)
self.app = app
self.dispatcher = RPCDispatcher()
transport = WsgiServerTransport(queue_class=gevent.queue.Queue)
# start wsgi server as a background-greenlet
self.wsgi_server = gevent.wsgi.WSGIServer(('127.0.0.1', 5000), transport.handle)
self.rpc_server = RPCServerGreenlets(
transport,
JSONRPCProtocol(),
self.dispatcher
)
示例4: make_app
# 需要导入模块: import gevent [as 别名]
# 或者: from gevent import wsgi [as 别名]
def make_app():
return tornado.wsgi.WSGIApplication([
(r"/", MainHandler),
(r"/query", QueryHandler)],
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
debug=True)
示例5: serve_gevent
# 需要导入模块: import gevent [as 别名]
# 或者: from gevent import wsgi [as 别名]
def serve_gevent(app):
from gevent.wsgi import WSGIServer
http_server = WSGIServer((host, port), app)
http_server.serve_forever()