diff --git a/notfellchen.cfg b/notfellchen.cfg index 46b69b8..dcff6c4 100644 --- a/notfellchen.cfg +++ b/notfellchen.cfg @@ -8,6 +8,7 @@ host=localhost [django] secret=CHANGE-ME debug=True +internal_ips=["127.0.0.1"] [database] backend=sqlite3 diff --git a/pyproject.toml b/pyproject.toml index 922e642..028640f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ dependencies = [ "drf-spectacular[sidecar]", "django-widget-tweaks", "django-super-deduper", - "django-allauth[mfa]" + "django-allauth[mfa]", ] dynamic = ["version", "readme"] @@ -49,6 +49,7 @@ develop = [ "pytest", "coverage", "model_bakery", + "debug_toolbar", ] docs = [ "sphinx", diff --git a/src/notfellchen/settings.py b/src/notfellchen/settings.py index 634ddfc..0b95c2a 100644 --- a/src/notfellchen/settings.py +++ b/src/notfellchen/settings.py @@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ - +import json from pathlib import Path import os import configparser @@ -74,6 +74,10 @@ except configparser.NoSectionError: raise BaseException("No config found or no Django Secret is configured!") DEBUG = config.getboolean('django', 'debug', fallback=False) +# Internal IPs +raw_config_value = config.get("django", "internal_ips", fallback=[]) +INTERNAL_IPS = json.loads(raw_config_value) + """ DATABASE """ DB_BACKEND = config.get("database", "backend", fallback="sqlite3") DB_NAME = config.get("database", "name", fallback="notfellchen.sqlite3") @@ -85,6 +89,7 @@ DB_HOST = config.get("database", "host", fallback='') BASE_DIR = Path(__file__).resolve().parent.parent LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')] + """ CELERY + KEYDB """ CELERY_BROKER_URL = config.get("celery", "broker", fallback="redis://localhost:6379/0") CELERY_RESULT_BACKEND = config.get("celery", "backend", fallback="redis://localhost:6379/0") @@ -229,10 +234,12 @@ INSTALLED_APPS = [ 'drf_spectacular', 'drf_spectacular_sidecar', # required for Django collectstatic discovery 'widget_tweaks', + "debug_toolbar", ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + "debug_toolbar.middleware.DebugToolbarMiddleware", # Static file serving & caching 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', diff --git a/src/notfellchen/urls.py b/src/notfellchen/urls.py index 794aa85..9429494 100644 --- a/src/notfellchen/urls.py +++ b/src/notfellchen/urls.py @@ -18,13 +18,14 @@ from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.urls import include, path from django.conf import settings - from django.conf.urls.static import static +from debug_toolbar.toolbar import debug_toolbar_urls + urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('allauth.urls')), -] +] + debug_toolbar_urls() urlpatterns += i18n_patterns( path("", include("fellchensammlung.urls")),