
- Setup FastAPI project structure with main.py and requirements.txt - Implement SQLAlchemy ORM with SQLite database - Create Item model with CRUD operations - Implement health endpoint for monitoring - Setup Alembic for database migrations - Add comprehensive documentation in README.md - Configure Ruff for code linting
29 lines
647 B
Python
29 lines
647 B
Python
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# API configuration
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "RESTAPIService"
|
|
PROJECT_DESCRIPTION: str = "FastAPI REST API Service"
|
|
VERSION: str = "0.1.0"
|
|
|
|
# CORS Origins
|
|
BACKEND_CORS_ORIGINS: list[str] = ["*"]
|
|
|
|
# Database
|
|
DB_DIR = Path("/app") / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
# SQLite Database URL
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings()
|