I'm learning fastapi. I have a very simple project structure like this
.
├── __init__.py
├── database.py
├── main.py
├── models.py
├── requirements.txt
└── schemas.py
Inside main.py
is
from fastapi import FastAPI
from typing import Optional
from . import schemas, models
from .database import engine
app = FastAPI()
# more code here...
but when I run this with uvicorn main:app --reload
I get the error
...
from . import schemas, models
ImportError: attempted relative import with no known parent package
I don't understand why I'm getting this error. I'm loosely following this tutorial. I've also read through numerous related SO questions (1 2 3), but none seem to match my situation.