Developer Dashboard — sicheres Server-Monitoring mit Django
Im Rahmen meines Django-Blog-Projekts datemyhobby.com habe ich ein passwortgeschütztes Developer Dashboard entwickelt. Es zeigt Live-Server-Metriken, ermöglicht gerouterte Befehle via Allowlist-Terminal und bietet eine datenbankgestützte Artikel-Analyse — ein praktisches Arbeitsbeispiel für Data Engineering mit Django.
Features im Überblick
- Server-Metriken — Uptime, RAM, Disk, Load Average direkt aus
/proc - Service-Status — Nginx, Gunicorn, PostgreSQL, fail2ban per systemctl
- Artikel-Analytics — KPI-Cards, Chart.js Balken- & Donut-Chart, Kategoriverteilung
- Allowlist-Terminal — 16 vordefinierte Befehle, kein freier Shell-Zugriff
- Integrierter Test-Runner — startet Django-Tests direkt im Browser
- Routen- & Migrations-Übersicht — alle URLs und DB-Migrationen auf einen Blick
Sicherheitsarchitektur
Das Dashboard implementiert Defense-in-Depth: Session-Auth mit Brute-Force-Schutz (max. 5 Versuche / 15 Min.),
enforced Content-Security-Policy-Header auf jedem Response, sowie Allowlist-validierte
subprocess-Aufrufe ohne shell=True. Secrets werden via python-decouple aus der
.env-Datei geladen — kein Hardcoding.
Daten-Analyse: ORM als SQL-Abstraktion
Die Analytics-Funktionen nutzen Django ORM-Aggregationen und sind äquivalent zu PostgreSQL-Queries
mit DATE_TRUNC und GROUP BY:
# Artikel pro Monat (letzte 12 Monate)
Article.objects
.filter(created_at__gte=cutoff)
.annotate(month=TruncMonth("created_at"))
.values("month")
.annotate(count=Count("id"))
.order_by("month")
Chart.js 4.4 visualisiert die Ergebnisse — Daten werden server-seitig als JSON in den Template-Context injiziert, kein separater API-Endpunkt nötig.
Tech-Stack
- Django 5.2 / Python 3.10
- PostgreSQL (Prod) + SQLite (Tests, kein CREATEDB-Recht nötig)
- Chart.js 4.4, Bootstrap 5.3 + Bootstrap Icons
- Gunicorn + Nginx auf Ubuntu Server
- 67 automatisierte Tests (4 Apps)
Developer Dashboard — secure server monitoring with Django
As part of my Django blog project datemyhobby.com, I built a password-protected developer dashboard — a practical example combining security-first design with database-driven analytics.
Features
- Live server metrics — Uptime, RAM, Disk, Load Average from
/proc - Service health — Nginx, Gunicorn, PostgreSQL, fail2ban via systemctl
- Article analytics — KPI cards, Chart.js bar + doughnut charts, category breakdown
- Allowlist terminal — 16 predefined commands, no arbitrary shell access
- Integrated test runner — trigger Django tests directly from the browser
- Routes & migrations overview — all URLs and DB migrations at a glance
Security architecture
Defense-in-Depth: session authentication with rate limiting (5 attempts / 15 min),
enforced Content-Security-Policy headers on every dashboard response,
allowlist-validated subprocess calls with no shell=True,
and secrets loaded from .env via python-decouple.
Data analysis with Django ORM
Analytics use Django ORM aggregations — TruncMonth, Count, Avg —
equivalent to PostgreSQL DATE_TRUNC + GROUP BY queries.
Chart.js 4.4 receives data injected into the template context as JSON — no separate API endpoint needed.
Tech stack
- Django 5.2 / Python 3.10
- PostgreSQL (production) + SQLite (tests)
- Chart.js 4.4, Bootstrap 5.3 + Bootstrap Icons
- Gunicorn + Nginx on Ubuntu Server
- 67 automated tests across 4 apps