diff --git a/gw2raidar/settings.py b/gw2raidar/settings.py index a0fdfcc8..e9481edd 100644 --- a/gw2raidar/settings.py +++ b/gw2raidar/settings.py @@ -37,6 +37,8 @@ # (it can be set in `settings_local.py`) ALLOWED_HOSTS = [] +INTERNAL_IPS = ['127.0.0.1'] + # Application definition @@ -160,3 +162,8 @@ from .settings_local import * except ImportError: pass + +if DEBUG: + if importlib.util.find_spec("debug_toolbar"): + INSTALLED_APPS.append('debug_toolbar') + MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware') diff --git a/raidar/urls.py b/raidar/urls.py index 9926ae41..d1f21fd6 100644 --- a/raidar/urls.py +++ b/raidar/urls.py @@ -1,6 +1,7 @@ from django.conf import settings -from django.conf.urls import url +from django.conf.urls import url, include from django.contrib.auth import views as auth_views +import importlib from . import views @@ -30,3 +31,9 @@ url(r'^$', views.index, name = "index"), url(r'^global_stats(?:/(?P[0-9]+))?(?:/area-(?P[0-9]+))?(?P\.json)?$', views.global_stats, name = "global_stats"), ] + +if settings.DEBUG and importlib.util.find_spec('debug_toolbar'): + import debug_toolbar + urlpatterns = [ + url(r'^__debug__/', include(debug_toolbar.urls)), + ] + urlpatterns