Python werkzeug.serving.WSGIRequestHandler() Examples
The following are 2
code examples of werkzeug.serving.WSGIRequestHandler().
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
werkzeug.serving
, or try the search function
.
Example #1
Source File: serving_util.py From guildai with Apache License 2.0 | 6 votes |
def make_server(host, port, app, logging=True): if host is None: raise RuntimeError("host cannot be None") if port is None: raise RuntimeError("port cannot be None") if logging: request_handler = serving.WSGIRequestHandler else: request_handler = QuietRequestHandler try: return serving.make_server( host, port, app, threaded=True, request_handler=request_handler ) except socket.error as e: if host: raise log.debug( "error starting server on %s:%s (%s), " "trying IPv6 default host '::'", host, port, e, ) return serving.make_server("::", port, app, threaded=True)
Example #2
Source File: tfserve.py From tfserve with MIT License | 5 votes |
def run(self, host, port, middleware=None): """Werkzeug run implementation. `middleware` may be provided as a function to handle requests. It must accept the arguments `(handler, req)` where `handler` is the TFServeApp request handler and `req` is the request. """ app = self._init_app(middleware) server = serving.make_server( host, port, app, threaded=True, request_handler=serving.WSGIRequestHandler) server.serve_forever()