feat: Ad django debug toolbar
This commit is contained in:
		@@ -8,6 +8,7 @@ host=localhost
 | 
				
			|||||||
[django]
 | 
					[django]
 | 
				
			||||||
secret=CHANGE-ME
 | 
					secret=CHANGE-ME
 | 
				
			||||||
debug=True
 | 
					debug=True
 | 
				
			||||||
 | 
					internal_ips=["127.0.0.1"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[database]
 | 
					[database]
 | 
				
			||||||
backend=sqlite3
 | 
					backend=sqlite3
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ dependencies = [
 | 
				
			|||||||
    "drf-spectacular[sidecar]",
 | 
					    "drf-spectacular[sidecar]",
 | 
				
			||||||
    "django-widget-tweaks",
 | 
					    "django-widget-tweaks",
 | 
				
			||||||
    "django-super-deduper",
 | 
					    "django-super-deduper",
 | 
				
			||||||
    "django-allauth[mfa]"
 | 
					    "django-allauth[mfa]",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dynamic = ["version", "readme"]
 | 
					dynamic = ["version", "readme"]
 | 
				
			||||||
@@ -49,6 +49,7 @@ develop = [
 | 
				
			|||||||
    "pytest",
 | 
					    "pytest",
 | 
				
			||||||
    "coverage",
 | 
					    "coverage",
 | 
				
			||||||
    "model_bakery",
 | 
					    "model_bakery",
 | 
				
			||||||
 | 
					    "debug_toolbar",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
docs = [
 | 
					docs = [
 | 
				
			||||||
    "sphinx",
 | 
					    "sphinx",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/3.2/topics/settings/
 | 
				
			|||||||
For the full list of settings and their values, see
 | 
					For the full list of settings and their values, see
 | 
				
			||||||
https://docs.djangoproject.com/en/3.2/ref/settings/
 | 
					https://docs.djangoproject.com/en/3.2/ref/settings/
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					import json
 | 
				
			||||||
from pathlib import Path
 | 
					from pathlib import Path
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import configparser
 | 
					import configparser
 | 
				
			||||||
@@ -74,6 +74,10 @@ except configparser.NoSectionError:
 | 
				
			|||||||
    raise BaseException("No config found or no Django Secret is configured!")
 | 
					    raise BaseException("No config found or no Django Secret is configured!")
 | 
				
			||||||
DEBUG = config.getboolean('django', 'debug', fallback=False)
 | 
					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 """
 | 
					""" DATABASE """
 | 
				
			||||||
DB_BACKEND = config.get("database", "backend", fallback="sqlite3")
 | 
					DB_BACKEND = config.get("database", "backend", fallback="sqlite3")
 | 
				
			||||||
DB_NAME = config.get("database", "name", fallback="notfellchen.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
 | 
					BASE_DIR = Path(__file__).resolve().parent.parent
 | 
				
			||||||
LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
 | 
					LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
""" CELERY + KEYDB """
 | 
					""" CELERY + KEYDB """
 | 
				
			||||||
CELERY_BROKER_URL = config.get("celery", "broker", fallback="redis://localhost:6379/0")
 | 
					CELERY_BROKER_URL = config.get("celery", "broker", fallback="redis://localhost:6379/0")
 | 
				
			||||||
CELERY_RESULT_BACKEND = config.get("celery", "backend", 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',
 | 
				
			||||||
    'drf_spectacular_sidecar',  # required for Django collectstatic discovery
 | 
					    'drf_spectacular_sidecar',  # required for Django collectstatic discovery
 | 
				
			||||||
    'widget_tweaks',
 | 
					    'widget_tweaks',
 | 
				
			||||||
 | 
					    "debug_toolbar",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MIDDLEWARE = [
 | 
					MIDDLEWARE = [
 | 
				
			||||||
    'django.middleware.security.SecurityMiddleware',
 | 
					    'django.middleware.security.SecurityMiddleware',
 | 
				
			||||||
 | 
					    "debug_toolbar.middleware.DebugToolbarMiddleware",
 | 
				
			||||||
    # Static file serving & caching
 | 
					    # Static file serving & caching
 | 
				
			||||||
    'whitenoise.middleware.WhiteNoiseMiddleware',
 | 
					    'whitenoise.middleware.WhiteNoiseMiddleware',
 | 
				
			||||||
    'django.contrib.sessions.middleware.SessionMiddleware',
 | 
					    'django.contrib.sessions.middleware.SessionMiddleware',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,13 +18,14 @@ from django.conf.urls.i18n import i18n_patterns
 | 
				
			|||||||
from django.contrib import admin
 | 
					from django.contrib import admin
 | 
				
			||||||
from django.urls import include, path
 | 
					from django.urls import include, path
 | 
				
			||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
 | 
					 | 
				
			||||||
from django.conf.urls.static import static
 | 
					from django.conf.urls.static import static
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from debug_toolbar.toolbar import debug_toolbar_urls
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns = [
 | 
					urlpatterns = [
 | 
				
			||||||
    path('admin/', admin.site.urls),
 | 
					    path('admin/', admin.site.urls),
 | 
				
			||||||
    path('accounts/', include('allauth.urls')),
 | 
					    path('accounts/', include('allauth.urls')),
 | 
				
			||||||
]
 | 
					] + debug_toolbar_urls()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
urlpatterns += i18n_patterns(
 | 
					urlpatterns += i18n_patterns(
 | 
				
			||||||
    path("", include("fellchensammlung.urls")),
 | 
					    path("", include("fellchensammlung.urls")),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user