本文整理匯總了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()