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


Python waitress.serve方法代碼示例

本文整理匯總了Python中waitress.serve方法的典型用法代碼示例。如果您正苦於以下問題:Python waitress.serve方法的具體用法?Python waitress.serve怎麽用?Python waitress.serve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在waitress的用法示例。


在下文中一共展示了waitress.serve方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: launchWebEvolutionaryInfo

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def launchWebEvolutionaryInfo():
    print("WEBSERVER MODE")
    webpageTitle = "japonicus evolutionary statistics - v%.2f" % VERSION
    webApp, webServer = promoterz.webServer.core.build_server(webpageTitle)

    webServerProcess = Thread(
        target=waitress.serve,
        kwargs={
            "app": webServer,
            "listen": "0.0.0.0:8182"
        }
    )

    webServerProcess.start()
    return webApp 
開發者ID:Gab0,項目名稱:japonicus,代碼行數:17,代碼來源:japonicus.py

示例2: main

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def main():
    # waitress configuration
    kwargs = {}
    for option, value  in conf.items('waitress'):
        kwargs[option] = value
    waitress.serve(pywebdriver.app, **kwargs)

# Run application 
開發者ID:akretion,項目名稱:pywebdriver,代碼行數:10,代碼來源:waitress_server.py

示例3: _callFUT

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def _callFUT(self, app, **kw):
        from waitress import serve
        return serve(app, **kw) 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:5,代碼來源:test_init.py

示例4: run

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def run(self):
        logger.debug('Call waitress.serve in %r ...', self)
        wsgi_app = WSGIApp()
        server = waitress.create_server(wsgi_app, unix_socket=self.usock)
        wsgi_app.server = server
        self.server = server
        self.server_ready_event.set()
        server.run() 
開發者ID:msabramo,項目名稱:requests-unixsocket,代碼行數:10,代碼來源:testutils.py

示例5: run_server

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def run_server(info):
    app = info.load_app()
    Limiter(
        app,
        key_func=get_ipaddr,
        default_limits=config.config.rate_limit
    )
    if config.config.allow_cors:
        CORS(app)
    serve(app, host=config.config.host, port=config.config.port) 
開發者ID:ZerataX,項目名稱:matrix-registration,代碼行數:12,代碼來源:app.py

示例6: server

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def server(reload=False):
    "Run the server"
    if reload:
        reload_module.reload_me("server")
    else:
        waitress.serve(app, host=app.config["HOST"], port=app.config["PORT"],
                threads=app.config["THREADS"]) 
開發者ID:puffinrocks,項目名稱:puffin,代碼行數:9,代碼來源:puffin.py

示例7: run

# 需要導入模塊: import waitress [as 別名]
# 或者: from waitress import serve [as 別名]
def run(argv=sys.argv, _serve=serve):
    """Command line runner."""
    name = os.path.basename(argv[0])

    try:
        kw, args = Adjustments.parse_args(argv[1:])
    except getopt.GetoptError as exc:
        show_help(sys.stderr, name, str(exc))
        return 1

    if kw['help']:
        show_help(sys.stdout, name)
        return 0

    if len(args) != 1:
        show_help(sys.stderr, name, 'Specify one application only')
        return 1

    try:
        module, obj_name = match(args[0])
    except ValueError as exc:
        show_help(sys.stderr, name, str(exc))
        return 1

    # Add the current directory onto sys.path
    sys.path.append(os.getcwd())

    # Get the WSGI function.
    try:
        app = resolve(module, obj_name)
    except ImportError:
        show_help(sys.stderr, name, "Bad module '{0}'".format(module))
        return 1
    except AttributeError:
        show_help(sys.stderr, name, "Bad object name '{0}'".format(obj_name))
        return 1
    if kw['call']:
        app = app()

    # These arguments are specific to the runner, not waitress itself.
    del kw['call'], kw['help']

    _serve(app, **kw)
    return 0 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:46,代碼來源:runner.py


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