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 6d0eaefac..bcfb12c69 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,6 +17,7 @@ pbr>=0.11 six==1.17.0 sqlparse==0.5.3 # 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 @@ -103,7 +104,7 @@ ctlsettings==0.4.3 django-extensions==3.2.3 django-s3sign==0.4.0 -s3transfer==0.10.0 +s3transfer==0.10.4 jmespath==1.0.1 botocore>=1.16.0,<1.36.0 @@ -119,7 +120,7 @@ cached-property==2.0 platformdirs==4.3.2 # zeep attrs==24.3.0 # zeep -zeep==4.3.0 +zeep==4.3.1 stevedore==5.4.0 pyyaml==6.0.2