diff --git a/mediathread/settings_shared.py b/mediathread/settings_shared.py index eb5ddf93a..0d27f68c4 100644 --- a/mediathread/settings_shared.py +++ b/mediathread/settings_shared.py @@ -212,9 +212,11 @@ def default_url_processor(url, label=None, request=None): LTI_EXTRA_PARAMETERS = ['custom_course_context'] -if 'test' in sys.argv or \ - 'jenkins' in sys.argv or \ - 'integrationserver' in sys.argv: +TESTING = ('test' in sys.argv or 'jenkins' in sys.argv or + 'integrationserver' in sys.argv) +DEVELOPMENT = 'runserver' in sys.argv + +if TESTING: ENVIRONMENT = 'testing' DEBUG = True TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # noqa @@ -248,6 +250,16 @@ def default_url_processor(url, label=None, request=None): SESSION_COOKIE_SAMESITE = 'None' DCS_SESSION_COOKIE_SAMESITE = 'None' +if DEVELOPMENT: + INSTALLED_APPS = [ + *INSTALLED_APPS, + 'debug_toolbar', + ] + MIDDLEWARE = [ + 'debug_toolbar.middleware.DebugToolbarMiddleware', + *MIDDLEWARE, + ] + CSRF_COOKIE_SAMESITE = 'None' BLOCKED_EMAIL_DOMAINS = [] diff --git a/mediathread/urls.py b/mediathread/urls.py index ef21df42c..8cac00336 100644 --- a/mediathread/urls.py +++ b/mediathread/urls.py @@ -1,6 +1,7 @@ import os.path import courseaffils +from django.conf import settings from django.contrib import admin from django.contrib.auth.views import ( PasswordChangeView, PasswordChangeDoneView, @@ -45,6 +46,7 @@ from mediathread.taxonomy.api import TermResource, VocabularyResource from registration.backends.default.views import RegistrationView from tastypie.api import Api +from debug_toolbar.toolbar import debug_toolbar_urls tastypie_api = Api('') @@ -285,3 +287,8 @@ path('s////', ProjectPublicView.as_view(), name='collaboration-obj-view'), ] + +if settings.DEVELOPMENT: + urlpatterns = [ + *urlpatterns, + ] + debug_toolbar_urls() diff --git a/requirements.txt b/requirements.txt index ce40254de..5c3b1d390 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,6 +17,7 @@ pbr>=0.11 six==1.17.0 sqlparse==0.5.0 # django-debug-toolbar +django-debug-toolbar==4.4.6 python-mimeparse==2.0.0 # tastypie python-dateutil==2.9.0 # tastypie defusedxml==0.7.1 # tastypie