pip3 install fastapi # ASGI 服务:uvicorn: pip3 install uvicorn

from fastapi import FastAPI
import uvicorn
app = FastAPI()


@app.get("/{name}")
def read_root(name):
return {"Hello": "World, " + name}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}


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

python  发布api框架  fastapi   flask restful   Api构建框架

python  发布api框架  fastapi   flask restful   Api构建框架

 

 

 

python  发布api框架  fastapi   flask restful   Api构建框架

 

 ERROR:    Error loading ASGI app. Could not import module "img".

源码文件名称不对原因

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2021-05-25
  • 2021-07-13
  • 2021-03-06
相关资源
相似解决方案