main #1
|
@ -61,6 +61,9 @@ THIRDPARTY_APPS = [
|
|||
"phonenumber_field",
|
||||
]
|
||||
|
||||
if DEBUG:
|
||||
THIRDPARTY_APPS += ["debug_toolbar"]
|
||||
|
||||
LOCAL_APPS = [
|
||||
"shiftregister.app",
|
||||
"shiftregister.core",
|
||||
|
@ -87,6 +90,9 @@ MIDDLEWARE = [
|
|||
"shiftregister.app.middleware.check_helper",
|
||||
]
|
||||
|
||||
if DEBUG:
|
||||
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
|
||||
|
||||
ROOT_URLCONF = "shiftregister.urls"
|
||||
|
||||
LOGIN_URL = "/admin/login/"
|
||||
|
@ -260,3 +266,26 @@ LOGGING = {
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
# Debug Toolbar settings
|
||||
if DEBUG:
|
||||
INTERNAL_IPS = ["127.0.0.1"]
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
"SHOW_TOOLBAR_CALLBACK": lambda request: True, # Always show toolbar in debug mode
|
||||
"SHOW_TEMPLATE_CONTEXT": True,
|
||||
"SQL_WARNING_THRESHOLD": 100, # ms
|
||||
}
|
||||
DEBUG_TOOLBAR_PANELS = [
|
||||
"debug_toolbar.panels.timer.TimerPanel",
|
||||
"debug_toolbar.panels.settings.SettingsPanel",
|
||||
"debug_toolbar.panels.headers.HeadersPanel",
|
||||
"debug_toolbar.panels.request.RequestPanel",
|
||||
"debug_toolbar.panels.sql.SQLPanel",
|
||||
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
|
||||
"debug_toolbar.panels.templates.TemplatesPanel",
|
||||
"debug_toolbar.panels.cache.CachePanel",
|
||||
"debug_toolbar.panels.signals.SignalsPanel",
|
||||
"debug_toolbar.panels.logging.LoggingPanel",
|
||||
"debug_toolbar.panels.redirects.RedirectsPanel",
|
||||
"debug_toolbar.panels.profiling.ProfilingPanel",
|
||||
]
|
||||
|
|
|
@ -16,6 +16,7 @@ Including another URLconf
|
|||
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from django.conf import settings
|
||||
|
||||
urlpatterns = [
|
||||
path("", include("shiftregister.metrics.urls")),
|
||||
|
@ -28,3 +29,10 @@ urlpatterns = [
|
|||
path("messages/", include("shiftregister.messaging.urls")),
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
import debug_toolbar
|
||||
|
||||
urlpatterns += [
|
||||
path("__debug__/", include(debug_toolbar.urls)),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue