本文整理汇总了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
示例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
示例3: _callFUT
# 需要导入模块: import waitress [as 别名]
# 或者: from waitress import serve [as 别名]
def _callFUT(self, app, **kw):
from waitress import serve
return serve(app, **kw)
示例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()
示例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)
示例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"])
示例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