sanic-00

how to install

python3 -m pip install sanic

getting_started

安装完成之后 写下一个 run.py 文件 直接使用py3 运行即可 代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# run.py
from sanic import Sanic
from sanic.response import text


app = Sanic(__name__)


@app.route("/")
async def test(request):
return text("Hello tiny world!")


app.run(host="0.0.0.0",
port=10080,
debug=True)