I have downloaded fastapi , but got an error of no module found
so I installed in virtual environment , where I used
pip install fastapi[all]
main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
Now I am trying to run this I get
(venv) C:UsersDELLDesktopAPI>uvicorn main:app
ERROR: Error loading ASGI app. Attribute "app" not found in module "main".
I even tried
uvicorn main:app --reload
but still not worked Where am I going wrong I am sure that I am using virtual environment , and virtual environment python interpretor too
Need to solve this, I am expecting
{message: Hello World}
New contributor
asra ANSARI is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.