This commit is contained in:
Ross
2025-12-15 21:44:57 +00:00
parent 9fc2ba3210
commit b48382e990
3 changed files with 23 additions and 1 deletions
+11
View File
@@ -43,10 +43,14 @@ INSTALLED_APPS += [
"rota",
"crispy_forms",
"crispy_bulma",
# Debug toolbar for local development
"debug_toolbar",
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
# Debug toolbar middleware should run as early as possible
"debug_toolbar.middleware.DebugToolbarMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
@@ -133,6 +137,13 @@ STATICFILES_DIRS = [
BASE_DIR.parent / "static",
]
# django-debug-toolbar settings (development only)
INTERNAL_IPS = ["127.0.0.1", "::1"]
# Simple debug toolbar config: show when DEBUG is True and request comes from INTERNAL_IPS
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda request: DEBUG,
}
# Default primary key field type
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
+10
View File
@@ -17,8 +17,18 @@ Including another URLconf
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
urlpatterns = [
path("admin/", admin.site.urls),
path("", include(("rota.urls", "rota"), namespace="rota")),
]
if settings.DEBUG:
try:
import debug_toolbar
urlpatterns = [path("__debug__/,", include(debug_toolbar.urls))] + urlpatterns
except Exception:
# debug_toolbar not installed; skip
pass
+2 -1
View File
@@ -17,4 +17,5 @@ highspy
typer
django>=6.0,<7
django-crispy-forms
crispy-bulma
crispy-bulma
django-debug-toolbar