
- Set up FastAPI project structure with API versioning - Create database models for users and tasks - Implement SQLAlchemy ORM with SQLite database - Initialize Alembic for database migrations - Create API endpoints for task management (CRUD) - Create API endpoints for user management - Add JWT authentication and authorization - Add health check endpoint - Add comprehensive README.md with API documentation
32 lines
858 B
Python
32 lines
858 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""
|
|
Application settings
|
|
"""
|
|
# Project info
|
|
PROJECT_NAME: str = "Task Management Tool"
|
|
PROJECT_DESCRIPTION: str = "A FastAPI backend for managing tasks"
|
|
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"
|
|
|
|
# JWT settings
|
|
SECRET_KEY: str = os.getenv("SECRET_KEY", "supersecretkey")
|
|
ACCESS_TOKEN_EXPIRE_MINUTES: int = int(
|
|
os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "30")
|
|
)
|
|
|
|
# Configure Pydantic to read environment variables
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
|
)
|
|
|
|
settings = Settings()
|