mirror of
https://github.com/ZTatman/myst.git
synced 2026-11-20 12:03:30 +00:00
Move page routes to routers/dashboard.py, the content-negotiated error handler to errors.py (register_error_handlers), and the dev css-mtime endpoint to routers/dev.py (included only when debug). main.py shrinks to lifespan + wiring + the / landing route. Dashboard repos now load lazily via an htmx fragment so a slow/unreachable Forgejo instance never blocks first paint; Forgejo html_url is sanitized against non-http(s) schemes before rendering into href.
14 lines
432 B
Python
14 lines
432 B
Python
"""Shared Jinja2 template engine — importable without circular deps."""
|
|
|
|
from pathlib import Path
|
|
|
|
from jinja2_fragments.fastapi import Jinja2Blocks
|
|
|
|
from app.config import get_settings
|
|
|
|
TEMPLATES_DIR = Path(__file__).parent / "templates"
|
|
|
|
templates = Jinja2Blocks(directory=str(TEMPLATES_DIR))
|
|
|
|
# Expose the debug flag to every template (gates the dev-only CSS live reload).
|
|
templates.env.globals["debug"] = get_settings().debug
|