
- Set up project structure and dependencies - Implement database models with SQLAlchemy - Set up Alembic migrations - Create FastAPI application with CORS support - Implement API endpoints (CRUD operations) - Add health check endpoint - Update README with setup and usage instructions
22 lines
638 B
Python
22 lines
638 B
Python
from pathlib import Path
|
|
from pydantic_settings import BaseSettings
|
|
|
|
class Settings(BaseSettings):
|
|
# Project settings
|
|
PROJECT_NAME: str = "Generic REST API"
|
|
PROJECT_DESCRIPTION: str = "A generic REST API built with FastAPI and SQLite"
|
|
PROJECT_VERSION: str = "0.1.0"
|
|
|
|
# Database settings
|
|
DB_DIR: Path = Path("/app") / "storage" / "db"
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
# Create settings instance
|
|
settings = Settings()
|
|
|
|
# Ensure DB directory exists
|
|
settings.DB_DIR.mkdir(parents=True, exist_ok=True) |