Automated Action bf1393d643 Create Simple Todo API with FastAPI and SQLite
- Set up FastAPI project structure
- Configure SQLAlchemy with SQLite
- Create Todo model and schemas
- Implement CRUD operations
- Add API endpoints for Todo management
- Configure Alembic for database migrations
- Add health check endpoint
- Add comprehensive documentation
2025-05-17 20:16:30 +00:00

32 lines
772 B
Python

from pathlib import Path
from typing import List
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
# Project settings
PROJECT_NAME: str = "SimpleTodoAPI"
PROJECT_DESCRIPTION: str = "A simple FastAPI Todo API with SQLite"
PROJECT_VERSION: str = "0.1.0"
# CORS
CORS_ORIGINS: List[str] = ["*"]
# Database
DB_DIR: Path = Path("/app") / "storage" / "db"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
model_config = SettingsConfigDict(
case_sensitive=True,
env_file=".env",
env_file_encoding="utf-8",
)
# Create instance of Settings
settings = Settings()
# Ensure database directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)