Automated Action cbb631170b Create a quick and simple FastAPI application with SQLite
This commit includes:
- Basic project structure with FastAPI
- SQLite database integration using SQLAlchemy
- CRUD API for items
- Alembic migrations setup
- Health check endpoint
- Proper error handling
- Updated README with setup instructions
2025-06-06 00:29:59 +00:00

29 lines
814 B
Python

import os
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
# Project settings
PROJECT_NAME: str = "QuickSimpleAPI"
PROJECT_DESCRIPTION: str = "A quick and simple FastAPI application"
VERSION: str = "0.1.0"
# Database settings
DB_DIR: Path = Path("/app") / "storage" / "db"
DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
# Security settings
SECRET_KEY: str = os.environ.get("SECRET_KEY", "development_secret_key")
model_config = SettingsConfigDict(
env_file=".env",
env_file_encoding="utf-8",
case_sensitive=True,
)
# Create an instance of the settings
settings = Settings()
# Ensure DB directory exists
settings.DB_DIR.mkdir(parents=True, exist_ok=True)