
- Set up project structure and FastAPI app - Create database models and SQLAlchemy connection - Implement Alembic migration scripts - Add CRUD API endpoints for Todo items - Add health check endpoint - Set up validation, error handling, and middleware - Add comprehensive documentation in README.md
34 lines
839 B
Python
34 lines
839 B
Python
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
PROJECT_NAME: str = "Simple Todo Application"
|
|
|
|
# CORS Configuration
|
|
CORS_ORIGINS: List[str] = ["*"]
|
|
CORS_ALLOW_CREDENTIALS: bool = True
|
|
CORS_ALLOW_METHODS: List[str] = ["*"]
|
|
CORS_ALLOW_HEADERS: List[str] = ["*"]
|
|
|
|
# API Settings
|
|
API_V1_STR: str = ""
|
|
|
|
# Database Configuration
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
case_sensitive=True,
|
|
)
|
|
|
|
def __init__(self, **kwargs):
|
|
super().__init__(**kwargs)
|
|
# Ensure DB directory exists
|
|
self.DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
settings = Settings() |