
- Set up FastAPI project structure with best practices - Implemented SQLAlchemy models with SQLite database - Added Alembic for database migrations - Created CRUD API endpoints for items - Added health check endpoint - Updated documentation generated with BackendIM... (backend.im)
26 lines
760 B
Python
26 lines
760 B
Python
from typing import List
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
# Base settings
|
|
PROJECT_NAME: str = "FastAPI Endpoint Service"
|
|
PROJECT_DESCRIPTION: str = "A fast endpoint service built with FastAPI"
|
|
VERSION: str = "0.1.0"
|
|
API_V1_STR: str = "/api/v1"
|
|
SECRET_KEY: str = "change-this-in-production"
|
|
DEBUG: bool = True
|
|
|
|
# CORS settings
|
|
CORS_ORIGINS: List[str] = ["*"]
|
|
|
|
# Database
|
|
DB_DIR = Path("/app") / "storage" / "db"
|
|
DB_DIR.mkdir(parents=True, exist_ok=True)
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
SQLALCHEMY_POOL_RECYCLE: int = 3600
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
|
|
settings = Settings() |