feat: Ad django debug toolbar
This commit is contained in:
		@@ -8,6 +8,7 @@ host=localhost
 | 
			
		||||
[django]
 | 
			
		||||
secret=CHANGE-ME
 | 
			
		||||
debug=True
 | 
			
		||||
internal_ips=["127.0.0.1"]
 | 
			
		||||
 | 
			
		||||
[database]
 | 
			
		||||
backend=sqlite3
 | 
			
		||||
 
 | 
			
		||||
@@ -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",
 | 
			
		||||
 
 | 
			
		||||
@@ -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',
 | 
			
		||||
 
 | 
			
		||||
@@ -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")),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user