Add Radeln ohne Alter ride-coordination demo (Django + HTMX + Leaflet)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
5d967c68b5
40 changed files with 2040 additions and 0 deletions
95
config/settings.py
Normal file
95
config/settings.py
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
"""Django-Settings für die 'Radeln ohne Alter'-Demo.
|
||||
|
||||
Bewusst schlank: SQLite, eine Handvoll Abhängigkeiten. Sicherheitsrelevante
|
||||
Schalter (DEBUG, SECRET_KEY, ALLOWED_HOSTS) sind per Umgebungsvariable
|
||||
übersteuerbar, damit dieselbe Codebasis lokal (DEBUG an) und öffentlich
|
||||
(DEBUG aus) laufen kann.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def _env_bool(name: str, default: bool) -> bool:
|
||||
return os.environ.get(name, "1" if default else "0") == "1"
|
||||
|
||||
|
||||
SECRET_KEY = os.environ.get("SECRET_KEY", "django-insecure-demo-key-not-for-production")
|
||||
DEBUG = _env_bool("DEBUG", True)
|
||||
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "*").split(",")
|
||||
|
||||
# Demo-Login (Rollen-Buttons) bewusst von DEBUG ENTKOPPELT: so kann die
|
||||
# öffentliche Demo mit DEBUG=False (sicher, keine Tracebacks) laufen und die
|
||||
# Rollen-Buttons trotzdem aktiv lassen.
|
||||
DEMO_MODE = _env_bool("DEMO_MODE", True)
|
||||
|
||||
CSRF_TRUSTED_ORIGINS = [o for o in os.environ.get("CSRF_TRUSTED_ORIGINS", "").split(",") if o]
|
||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"rides",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "config.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [BASE_DIR / "templates"],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"rides.context_processors.user_profile",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "config.wsgi.application"
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": BASE_DIR / "db.sqlite3",
|
||||
}
|
||||
}
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [] # Demo: keine Passwort-Policy
|
||||
|
||||
LANGUAGE_CODE = "de"
|
||||
TIME_ZONE = "Europe/Berlin"
|
||||
USE_I18N = True
|
||||
USE_TZ = True
|
||||
|
||||
STATIC_URL = "static/"
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
STORAGES = {
|
||||
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
|
||||
"staticfiles": {"BACKEND": "whitenoise.storage.CompressedStaticFilesStorage"},
|
||||
}
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
LOGIN_URL = "home"
|
||||
Loading…
Add table
Add a link
Reference in a new issue