FastAPI - Error loading ASGI app. Could not import module "main"
I have this structure in FastAPI. project_folder/ project_folder/app/ project_folder/app/main.py (with app object of FastAPI) project_folder/app/rest/panel.py (here I try import app object from main) In panel.py I import by: from ..main import app or from app.main import app Its works with other files... like "from app.models import XYZModel". I run by command: bash -c "uvicorn main:app --host 0.0.0.0 --port 8000 --reload" and I try this: bash -c "uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload" It works. All paths and imports to multiple files inside different directories work fine.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.