Reload the browser on template and static changes in dev

Adds django-browser-reload: runserver already restarts on Python changes, but
the browser had to be refreshed by hand for every template or CSS edit. It also
watches static/, so a Tailwind rebuild now refreshes the page on its own.

Mounted only under DEBUG -- it injects a script into every HTML response and
serves an open event stream, neither of which belongs in production; a test
holds that line. Its endpoint is exempt from RequireMFAMiddleware, otherwise a
not-yet-enrolled staff user has the stream redirected away and live reload dies
on the MFA enrolment page, which is exactly a page we are restyling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 18:32:19 +02:00
parent 268cbe1e06
commit 334c706aec
16 changed files with 473 additions and 3 deletions

View File

@@ -0,0 +1,33 @@
{% load static lucide %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RosterChief - Control Panel</title>
<script>
(() => {
const stored = localStorage.getItem('theme');
if (stored) document.documentElement.setAttribute("data-theme", stored);
})();
</script>
<style>
:root {
--logo-light: url("{% static "images/rosterchief-white.svg" %}");
--logo-dark: url("{% static "images/rosterchief-black.svg" %}");
}
</style>
<link rel="stylesheet" href="{% static 'css/app.css' %}"/>
{% block extra %}{% endblock extra %}
</head>
<body class="min-h-screen bg-base-200">
{% block main %}{% endblock main %}
</body>
</html>

View File

@@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "_controlpanel_base.html" %}
{% block title %}
{% block head_title %}{% endblock head_title %} · RosterChief