#Uvicorn start server (FastAPI)

5 messages · Page 1 of 1 (latest)

tiny wasp
#

Hello, how do I start my uvicord server?
I came back to my project after a while and I think I'm doing it right, but it seems like I'm not

Rank-Crawler-Backend/app/api.py

from fastapi import FastAPI
# ...
app = FastAPI()
# ...

PowerShell: .../Rank-Crawler-Backend

uvicorn app.api:app --reload

INFO:     Will watch for changes in these directories: ['C:\\Users\\USER\\documents\\projects\\Rank-Crawler-Backend']
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [13712] using StatReload
ERROR:    Error loading ASGI app. Attribute "app" not found in module "app.api".
wintry spoke
#

You might be missing a __init__.py file in the module folder?

tiny wasp
dull fjord
#

I can't think of a reason why that'd be happening... out of curiosity do the following and tell me what happens

  1. Create a __init__.py inside the app folder
  2. Inside __init__.py put from app.api import app
  3. From the folder that the app folder is in, run uvicorn app:app
#

If it's an import issue I'd expect the same error message