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)