Automated Action bff5c53372 Fix Pydantic error in Settings class
- Add ClassVar type annotation to DB_DIR field
- Move directory creation logic outside of Settings class
- Update config class to use model_config dict format for Pydantic v2
- Fix database migration error related to non-annotated attribute
2025-06-10 15:02:39 +00:00

29 lines
713 B
Python

"""Application configuration settings."""
from pathlib import Path
from typing import ClassVar
from pydantic_settings import BaseSettings
# Create database directory
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
class Settings(BaseSettings):
"""Application settings."""
PROJECT_NAME: str = "Task Manager API"
PROJECT_DESCRIPTION: str = "A FastAPI-based Task Manager API"
VERSION: str = "0.1.0"
API_V1_STR: str = "/api/v1"
# Database
DB_DIR: ClassVar[Path] = DB_DIR
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
model_config = {
"case_sensitive": True,
"env_file": ".env",
}
settings = Settings()