Skip to content

Commit

Permalink
Merge pull request #5667 from ccnmtl/django-debug-toolbar
Browse files Browse the repository at this point in the history
Add django-debug-toolbar in development mode
  • Loading branch information
ndittren authored Jan 8, 2025
2 parents e738c27 + ff3c1ff commit dc049d4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
18 changes: 15 additions & 3 deletions mediathread/settings_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand Down
7 changes: 7 additions & 0 deletions mediathread/urls.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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('')
Expand Down Expand Up @@ -285,3 +287,8 @@
path('s/<slug:context_slug>/<slug:obj_type>/<int:obj_id>/',
ProjectPublicView.as_view(), name='collaboration-obj-view'),
]

if settings.DEVELOPMENT:
urlpatterns = [
*urlpatterns,
] + debug_toolbar_urls()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dc049d4

Please sign in to comment.