mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-09 03:54:08 +00:00
Add support for easily enabling the django debug toolbar
This requires the web server to also configure a static mapping for /media/django_toolbar/ pointing into the django toolbar directories.
This commit is contained in:
@ -162,5 +162,15 @@ FRONTEND_SMTP_RELAY = "magus.postgresql.org" # Where to relay use
|
||||
OAUTH = {} # OAuth providers and keys
|
||||
PGDG_ORG_ID = -1 # id of the PGDG organisation entry
|
||||
|
||||
# For debug toolbar, can then be fully configured in settings_local.py
|
||||
DEBUG_TOOLBAR = False
|
||||
INTERNAL_IPS = [
|
||||
'127.0.0.1',
|
||||
]
|
||||
|
||||
# Load local settings overrides
|
||||
from .settings_local import *
|
||||
|
||||
if DEBUG and DEBUG_TOOLBAR:
|
||||
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
|
||||
INSTALLED_APPS.append('debug_toolbar')
|
||||
|
@ -1,5 +1,7 @@
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import path
|
||||
from django.views.generic import RedirectView
|
||||
from django.conf import settings
|
||||
|
||||
import pgweb.contributors.views
|
||||
import pgweb.core.views
|
||||
@ -156,3 +158,10 @@ urlpatterns = [
|
||||
# Fallback for static pages, must be at the bottom
|
||||
url(r'^(.*)/$', pgweb.core.views.fallback),
|
||||
]
|
||||
|
||||
|
||||
if settings.DEBUG_TOOLBAR:
|
||||
import debug_toolbar
|
||||
urlpatterns = [
|
||||
path('__debug__/', include(debug_toolbar.urls)),
|
||||
] + urlpatterns
|
||||
|
Reference in New Issue
Block a user