from pathlib import Path from pydantic_settings import BaseSettings class Settings(BaseSettings): PROJECT_NAME: str = "Todo Application" DB_DIR: Path = Path("/app") / "storage" / "db" # This ensures the DB_DIR exists def __init__(self, **kwargs): super().__init__(**kwargs) self.DB_DIR.mkdir(parents=True, exist_ok=True) @property def SQLALCHEMY_DATABASE_URL(self) -> str: return f"sqlite:///{self.DB_DIR}/db.sqlite" settings = Settings()