0
点赞
收藏
分享

微信扫一扫

[Python]初识sanic


安装(Install)

pip install sanic

Hello, world 应用(Hello, world application)

from sanic import Sanic
from sanic.response import text

app = Sanic("MyHelloWorldApp")

@app.get("/")
async def hello_world(request):
    return text("Hello, world.")

运行(Running)

让我们将上面写好的文件保存为 server.py, 然后运行它。

sanic server.app




[Python]初识sanic_文件保存


运行效果


[Python]初识sanic_文件保存_02


举报

相关推荐

0 条评论