当前位置: 首页>>代码示例>>Python>>正文


Python serving.WSGIRequestHandler方法代码示例

本文整理汇总了Python中werkzeug.serving.WSGIRequestHandler方法的典型用法代码示例。如果您正苦于以下问题:Python serving.WSGIRequestHandler方法的具体用法?Python serving.WSGIRequestHandler怎么用?Python serving.WSGIRequestHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在werkzeug.serving的用法示例。


在下文中一共展示了serving.WSGIRequestHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_server

# 需要导入模块: from werkzeug import serving [as 别名]
# 或者: from werkzeug.serving import WSGIRequestHandler [as 别名]
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) 
开发者ID:guildai,项目名称:guildai,代码行数:25,代码来源:serving_util.py

示例2: run

# 需要导入模块: from werkzeug import serving [as 别名]
# 或者: from werkzeug.serving import WSGIRequestHandler [as 别名]
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() 
开发者ID:iitzco,项目名称:tfserve,代码行数:16,代码来源:tfserve.py


注:本文中的werkzeug.serving.WSGIRequestHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。