gunicorn启动fastapi命令

from fastapi import FastAPI
import uvicorn
app = FastAPI()


@app.get("/")
async def root():
    return {"message": "Hello World"}


if __name__ == '__main__':
    uvicorn.run(app='main:app', host="127.0.0.1", port=8000, reload=True, debug=True)

# 启动命令 gunicorn main:app
-b 0.0.0.0:8001 -w 4 -k uvicorn.workers.UvicornWorker # -D 守护启动 -c 配置文件

参考链接:https://www.cnblogs.com/xubinbk/p/12886633.html

posted @ 2020-06-17 17:41  阿磊小哥哥呀  阅读(6219)  评论(0编辑  收藏  举报