I am getting a module not found error in a fastapi project even thought the path is correct, the files are as follows
models.py
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from myapplication.app.database import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String(255), unique=True, index=True)
hashed_password = Column(String(255))
is_active = Column(Boolean, default=True)
File "Projects\FastApiStructure\myapplication.\users\models.py", line 4, in from myapplication.app.database import Base ModuleNotFoundError: No module named 'myapplication'
database.py
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import as_declarative, declared_attr
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
engine = create_engine(settings.DATABASE_URI, pool_pre_ping=True)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
@as_declarative()
class Base:
@declared_attr
def __tablename__(cls) -> str:
return cls.__name__.lower()
my folder structure is as follows