From b5b43b71bd052b0779974ce02a1eb505e0b23e38 Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 17 Jul 2020 15:27:57 +0300 Subject: [PATCH] add dev options to settings + url --- webvirtcloud/settings-dev.py | 17 +++++++++++++++++ webvirtcloud/settings.py.template | 2 +- webvirtcloud/urls.py | 12 ++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/webvirtcloud/settings-dev.py b/webvirtcloud/settings-dev.py index dec75220..5f0b5950 100644 --- a/webvirtcloud/settings-dev.py +++ b/webvirtcloud/settings-dev.py @@ -9,3 +9,20 @@ DEBUG = True TEMPLATE_DEBUG = True + + +INSTALLED_APPS += [ + 'debug_toolbar', +] + +MIDDLEWARE += [ + 'debug_toolbar.middleware.DebugToolbarMiddleware', +] + +# DebugToolBar +INTERNAL_IPS = ( + '127.0.0.1', +) +DEBUG_TOOLBAR_CONFIG = { + 'INTERCEPT_REDIRECTS': False, +} \ No newline at end of file diff --git a/webvirtcloud/settings.py.template b/webvirtcloud/settings.py.template index 4606cac9..f31e7dd5 100644 --- a/webvirtcloud/settings.py.template +++ b/webvirtcloud/settings.py.template @@ -10,7 +10,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = '' -DEBUG = True +DEBUG = False ALLOWED_HOSTS = ['*'] diff --git a/webvirtcloud/urls.py b/webvirtcloud/urls.py index b32eb360..a2e14a8b 100644 --- a/webvirtcloud/urls.py +++ b/webvirtcloud/urls.py @@ -1,8 +1,9 @@ +from django.conf import settings from django.urls import include, path -from instances.views import index -from console.views import console from appsettings.views import appsettings +from console.views import console +from instances.views import index urlpatterns = [ path('', index, name='index'), @@ -16,3 +17,10 @@ path('i18n/', include('django.conf.urls.i18n')), path('logs/', include('logs.urls')), ] + +if settings.DEBUG: + import debug_toolbar + + urlpatterns += [ + path('__debug__/', include(debug_toolbar.urls)), + ]