Add Jinja2 web UI with Bootstrap 5 dark theme
- app/templates/: base layout with sidebar nav + 6 pages (dashboard, printers, jobs, filaments, todos, pricing) - app/routers/ui.py: HTML routes querying the DB live - API routes moved to /api/* prefix - requirements: jinja2, python-multipart Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
app/main.py
18
app/main.py
@@ -5,6 +5,7 @@ from fastapi import FastAPI
|
||||
|
||||
from app.db import check_db, run_migrations
|
||||
from app.routers import filaments, pricing, print_jobs, printers, todos
|
||||
from app.routers import ui
|
||||
|
||||
logger = logging.getLogger("pops")
|
||||
|
||||
@@ -22,16 +23,15 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
app = FastAPI(title="POPS", lifespan=lifespan)
|
||||
|
||||
app.include_router(printers.router)
|
||||
app.include_router(filaments.router)
|
||||
app.include_router(print_jobs.router)
|
||||
app.include_router(todos.router)
|
||||
app.include_router(pricing.router)
|
||||
# JSON API
|
||||
app.include_router(printers.router, prefix="/api")
|
||||
app.include_router(filaments.router, prefix="/api")
|
||||
app.include_router(print_jobs.router, prefix="/api")
|
||||
app.include_router(todos.router, prefix="/api")
|
||||
app.include_router(pricing.router, prefix="/api")
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root():
|
||||
return {"message": "Hello from POPS"}
|
||||
# Web UI (must come after API to avoid route shadowing)
|
||||
app.include_router(ui.router)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
|
||||
Reference in New Issue
Block a user