快速入门#

Hello World#

一个非常简单的应用程序,它只返回包含 hello 的响应,(文件 hello-world.py

from quart import Quart

app = Quart(__name__)

@app.route('/')
async def hello():
    return 'hello'

app.run()

并且只需通过以下方式运行

python hello-world.py

或者也可以通过以下方式

$ export QUART_APP=hello-world:app
$ quart run

并通过以下方式测试

curl localhost:5000

另请参见#

速查表