
- Created project structure with FastAPI setup - Added SQLite database connection with SQLAlchemy ORM - Implemented Todo model and schemas - Added CRUD operations for Todo items - Created API endpoints for Todo management - Added health check endpoint - Configured Alembic for database migrations - Updated project documentation in README.md
30 lines
756 B
Python
30 lines
756 B
Python
from pathlib import Path
|
|
from typing import List
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# API Configuration
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Todo API"
|
|
PROJECT_DESCRIPTION: str = "A simple TODO application API"
|
|
PROJECT_VERSION: str = "0.1.0"
|
|
|
|
# CORS Configuration
|
|
CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
# Database Configuration
|
|
DB_DIR: Path = Path("/app/storage/db")
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
env_file_encoding = "utf-8"
|
|
case_sensitive = True
|
|
|
|
|
|
settings = Settings()
|
|
|
|
# Create DB directory if it doesn't exist
|
|
settings.DB_DIR.mkdir(parents=True, exist_ok=True) |