Automated Action 6da81ed97c Complete Todo application implementation
- Update database path configuration
- Add test script for API functionality
- Update README with testing instructions
- Add requests package to requirements

generated with BackendIM... (backend.im)
2025-05-13 06:19:17 +00:00

26 lines
775 B
Python

from pydantic import BaseModel
from typing import Optional
from pathlib import Path
import os
class Settings(BaseModel):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "Todo API"
PROJECT_DESCRIPTION: str = "A simple Todo API built with FastAPI and SQLite"
VERSION: str = "0.1.0"
# Database settings
BASE_DIR: Path = Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
DB_DIR: Path = BASE_DIR / "storage" / "db"
SQLALCHEMY_DATABASE_URL: Optional[str] = None
class Config:
case_sensitive = True
settings = Settings()
# Ensure DB directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)
# Set the database URL
settings.SQLALCHEMY_DATABASE_URL = f"sqlite:///{settings.DB_DIR}/db.sqlite"