Sanic

Sanic 是一个 Python 3.6+ web 服务器和web框架,它的编写速度很快。它允许使用python 3.5中添加的 async/await 语法,这使得您的代码不阻塞,速度更快。

该项目的目标是提供一种简单的方法来启动和运行一个高性能的HTTP服务器,该服务器易于构建、扩展和最终扩展。

开发了Sanic on GitHub . 欢迎贡献!

Sanic 渴望简单

from sanic import Sanic
from sanic.response import json

app = Sanic("App Name")

@app.route("/")
async def test(request):
    return json({"hello": "world"})

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

注解

Sanic不支持19.6版和更高版本的python 3.5。然而,到2020年12月,18.12LTS版本得到了支持。3.5版的官方python支持将于2020年9月到期。

指南

模块文档