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


Python gevent.wsgi方法代碼示例

本文整理匯總了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' 
開發者ID:heikoheiko,項目名稱:pyethapp,代碼行數:24,代碼來源:jsonrpc.py

示例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() 
開發者ID:zhangzhengde0225,項目名稱:VaspCZ,代碼行數:8,代碼來源:bottle.py

示例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
        ) 
開發者ID:heikoheiko,項目名稱:pydevp2p,代碼行數:17,代碼來源:jsonrpc.py

示例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) 
開發者ID:ayoungprogrammer,項目名稱:nlquery,代碼行數:9,代碼來源:main.py

示例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() 
開發者ID:rgalanakis,項目名稱:hostthedocs,代碼行數:7,代碼來源:getconfig.py


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