Python gevent.wsgi() Examples

The following are 5 code examples of gevent.wsgi(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gevent , or try the search function .
Example #1
Source File: jsonrpc.py    From pyethapp with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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' 
Example #2
Source File: bottle.py    From VaspCZ with MIT License 5 votes vote down vote up
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() 
Example #3
Source File: jsonrpc.py    From pydevp2p with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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
        ) 
Example #4
Source File: main.py    From nlquery with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #5
Source File: getconfig.py    From hostthedocs with MIT License 5 votes vote down vote up
def serve_gevent(app):
    from gevent.wsgi import WSGIServer

    http_server = WSGIServer((host, port), app)
    http_server.serve_forever()