
- Set up project structure with FastAPI and SQLite - Create models for users, questions, and quizzes - Implement Alembic migrations with seed data - Add user authentication with JWT - Implement question management endpoints - Implement quiz creation and management - Add quiz-taking and scoring functionality - Set up API documentation and health check endpoint - Update README with comprehensive documentation
33 lines
943 B
Python
33 lines
943 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pydantic import BaseSettings, validator
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# Base settings
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "Bible Quiz App API"
|
|
PROJECT_DESCRIPTION: str = "API for a Bible Quiz application with questions, quizzes, and user management"
|
|
VERSION: str = "0.1.0"
|
|
|
|
# Security settings
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "change_this_secret_key_in_production")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "60"))
|
|
|
|
# Database settings
|
|
DB_DIR: Path = Path("/app/storage/db")
|
|
|
|
@validator("DB_DIR", pre=True)
|
|
def create_db_dir(cls, v: Path) -> Path:
|
|
v.mkdir(parents=True, exist_ok=True)
|
|
return v
|
|
|
|
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = True
|
|
|
|
|
|
settings = Settings() |