为什么 运行 带有 Hypercorn 的 Quart 应用程序/它不是自动的吗?

Why run Quart app with Hypercorn / isn't it automatic?

如果您检查 Quart 库,app.run() 只是建立一些配置然后使用 asyncio.run(serve(self, config)),其中服务来自 from hypercorn.asyncio import serve

因此,即使您通过 python myapp.py 运行 Quart 应用程序,它是否已经在使用 Hypercorn服务器?

特别是,这和 运行ning via hypercorn myapp:app 有什么区别?

https://pgjones.gitlab.io/quart/deployment.html

It is not recommended to run Quart directly (via run()) in production. Instead it is recommended that Quart be run using Hypercorn or an alternative ASGI server. Hypercorn is installed with Quart and is used to serve requests by default (e.g. with run()).

这么说,虽然Hypercorn默认是用run()来服务请求的,但是不推荐使用run()?还有其他人感到困惑吗?

So even if you run a Quart app via python myapp.py, isn't it already using a Hypercorn server?

是的。

In particular, what's the difference between this and running via hypercorn myapp:app?

我想为开发保留run方法,这样它可以默认做出对开发有利但对生产不利的决策。目前的一个例子是 run 方法默认使用重新加载器(每当代码更改时重新加载应用程序),这在开发时很好,但在生产中存在性能问题。另一个例子是 run 方法不会使用多个 worker,这再次导致生产性能变差。

(我是Quart作者)