【问题标题】:How to interface hypercorn and starlette web framwork如何连接 hypercorn 和 starlette web 框架
【发布时间】:2019-10-10 20:31:47
【问题描述】:

我能够使用 gunicorn 和 uvloop 启动并运行它,但很难使用 hypercorn 来实现它。另一个问题是指定 ASGI 框架的工作人员数量。

【问题讨论】:

    标签: python-3.x starlette hypercorn


    【解决方案1】:

    您可能有类似app = Starlette(debug=True) 这样的行,app 是一个可以由 Hypercorn(或其他 ASGI 服务器)运行的 ASGI 应用程序。如果此行位于名为 run.py 的文件中,您可以通过 hypercorn run:app 运行它。

    如果您想要多个工作人员(显示 2 个),您可以使用 hypercorn -w 2 run:app。如果你也想要 uvloop,hypercorn -w 2 -k uvloop run:app。

    【讨论】:

      猜你喜欢
      • 2010-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-08
      • 1970-01-01
      • 1970-01-01
      • 2016-06-03
      • 2020-11-18
      相关资源
      最近更新 更多