todoapp-rx2ww5/app/core/config.py

23 lines
548 B
Python

from typing import List
from pydantic_settings import BaseSettings
from pathlib import Path
# Create DB directory outside the model
DB_DIR = Path("/app") / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "Todo App"
ALLOWED_ORIGINS: List[str] = ["*"]
# Database settings
DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
model_config = {
"env_file": ".env",
"case_sensitive": True
}
settings = Settings()