Python编程:sanic异步web框架

忍禁

关注

阅读 90

2022-02-17


github: ​​https://github.com/huge-success/sanic​​

使用方式和Flask 基本一致

安装

pip3 install sanic

最简单的示例

# -*- coding: utf-8 -*-

from sanic import Sanic
from sanic.response import text

app = Sanic()


@app.route('/')
async def hello(request):
return text("hello sanic")


if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)



精彩评论(0)

0 0 举报