Files
ImpTune/imptune/main.py
T
kawa bd4e132f82 feat(01-01): create Docker scaffold, FastAPI app shell, and sidebar templates
- Dockerfile with python:3.12-slim-bookworm, curl downloads Pico CSS, HTMX, Alpine.js at build time
- docker-compose.yml with imptune_data:/data named volume and restart policy
- requirements.txt with all phase 1-5 dependencies
- imptune/config.py loading DATA_DIR/PORT from env with DB_PATH and DRIVERS_DIR derived paths
- imptune/main.py: FastAPI app with StaticFiles mount, health+pages routers, startup dir creation
- imptune/api/health.py: GET /health returning {"status": "ok"}
- imptune/api/pages.py: GET / returning dashboard.html with sync def handler
- imptune/templates/base.html: data-theme="auto", sidebar with 5 nav sections, /static/ paths only
- imptune/templates/dashboard.html: quick actions + empty state recent activity
- imptune/static/app.css: sidebar layout, active link highlight, quick action buttons
2026-04-10 11:25:08 +02:00

26 lines
649 B
Python

from pathlib import Path
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from imptune.api import health, pages
from imptune.config import DATA_DIR, DRIVERS_DIR
app = FastAPI(title="ImpTune")
# Serve baked-in static assets (pico.min.css, htmx.min.js, alpine.min.js)
_static_dir = Path(__file__).parent / "static"
app.mount("/static", StaticFiles(directory=str(_static_dir)), name="static")
# Register routers
app.include_router(health.router)
app.include_router(pages.router)
@app.on_event("startup")
def on_startup():
import os
os.makedirs(DATA_DIR, exist_ok=True)
os.makedirs(DRIVERS_DIR, exist_ok=True)