From 88747024b5d53ab4692334086bb2f326e3136352 Mon Sep 17 00:00:00 2001 From: Braden MacDonald <braden@opencraft.com> Date: Thu, 20 Nov 2014 14:35:52 -0500 Subject: [PATCH] Upgrade django-debug-toolbar to 1.2.2 This is compatible with Django > 1.5, and allows us to re-enable the ProfilingDebugPanel --- cms/envs/dev.py | 27 +++++++++------------------ cms/envs/dev_dbperf.py | 23 +++++++++-------------- cms/envs/devstack.py | 31 +++++++++++++++---------------- lms/envs/content.py | 23 +++++++++-------------- lms/envs/dev.py | 27 +++++++++------------------ lms/envs/devplus.py | 23 +++++++++-------------- lms/envs/devstack.py | 31 +++++++++++++++---------------- requirements/edx/base.txt | 10 ++-------- 8 files changed, 77 insertions(+), 118 deletions(-) diff --git a/cms/envs/dev.py b/cms/envs/dev.py index f0c639be9bd..5a2ed8f7b5a 100644 --- a/cms/envs/dev.py +++ b/cms/envs/dev.py @@ -139,26 +139,17 @@ MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) INTERNAL_IPS = ('127.0.0.1',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - # 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) -DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False -} - # To see stacktraces for MongoDB queries, set this to True. # Stacktraces slow down page loads drastically (for pages with lots of queries). DEBUG_TOOLBAR_MONGO_STACKTRACES = False diff --git a/cms/envs/dev_dbperf.py b/cms/envs/dev_dbperf.py index 610a974e3f5..7d800fa964f 100644 --- a/cms/envs/dev_dbperf.py +++ b/cms/envs/dev_dbperf.py @@ -9,21 +9,16 @@ This configuration is to turn on the Django Toolbar stats for DB access stats, f from .dev import * DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', 'debug_toolbar_mongo.panel.MongoDebugPanel' - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - # 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) # To see stacktraces for MongoDB queries, set this to True. diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index abb9abfa016..f0a6215a7b6 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -46,27 +46,26 @@ MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) INTERNAL_IPS = ('127.0.0.1',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - # 'debug_toolbar.panels.profiling.ProfilingPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False, - 'SHOW_TOOLBAR_CALLBACK': lambda _: True, + 'SHOW_TOOLBAR_CALLBACK': 'cms.envs.devstack.should_show_debug_toolbar' } + +def should_show_debug_toolbar(_): + return True # We always want the toolbar on devstack regardless of IP, auth, etc. + + # To see stacktraces for MongoDB queries, set this to True. # Stacktraces slow down page loads drastically (for pages with lots of queries). DEBUG_TOOLBAR_MONGO_STACKTRACES = False diff --git a/lms/envs/content.py b/lms/envs/content.py index 90c9f8a0fbf..dbb5886cafb 100644 --- a/lms/envs/content.py +++ b/lms/envs/content.py @@ -19,18 +19,13 @@ INSTALLED_APPS += ('debug_toolbar',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - # 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) diff --git a/lms/envs/dev.py b/lms/envs/dev.py index 718be631836..a465195b6c8 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -235,26 +235,17 @@ MIDDLEWARE_CLASSES += ( INTERNAL_IPS = ('127.0.0.1',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - # 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) -DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False -} - #################### FILE UPLOADS (for discussion forums) ##################### DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' diff --git a/lms/envs/devplus.py b/lms/envs/devplus.py index ef5ac3e0144..708e65fdc57 100644 --- a/lms/envs/devplus.py +++ b/lms/envs/devplus.py @@ -57,20 +57,15 @@ MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) INTERNAL_IPS = ('127.0.0.1',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - 'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) #PIPELINE = True diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 2b1f2e57308..df5bf1350da 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -54,28 +54,27 @@ MIDDLEWARE_CLASSES = ( INTERNAL_IPS = ('127.0.0.1',) DEBUG_TOOLBAR_PANELS = ( - 'debug_toolbar.panels.version.VersionDebugPanel', - 'debug_toolbar.panels.timer.TimerDebugPanel', - 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', - 'debug_toolbar.panels.headers.HeaderDebugPanel', - 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', - 'debug_toolbar.panels.sql.SQLDebugPanel', - 'debug_toolbar.panels.signals.SignalDebugPanel', - 'debug_toolbar.panels.logger.LoggingPanel', + 'debug_toolbar.panels.versions.VersionsPanel', + 'debug_toolbar.panels.timer.TimerPanel', + 'debug_toolbar.panels.settings.SettingsPanel', + 'debug_toolbar.panels.headers.HeadersPanel', + 'debug_toolbar.panels.request.RequestPanel', + 'debug_toolbar.panels.sql.SQLPanel', + 'debug_toolbar.panels.signals.SignalsPanel', + 'debug_toolbar.panels.logging.LoggingPanel', 'debug_toolbar_mongo.panel.MongoDebugPanel', - - # Enabling the profiler has a weird bug as of django-debug-toolbar==0.9.4 and - # Django=1.3.1/1.4 where requests to views get duplicated (your method gets - # hit twice). So you can uncomment when you need to diagnose performance - # problems, but you shouldn't leave it on. - #'debug_toolbar.panels.profiling.ProfilingDebugPanel', + 'debug_toolbar.panels.profiling.ProfilingPanel', ) DEBUG_TOOLBAR_CONFIG = { - 'INTERCEPT_REDIRECTS': False, - 'SHOW_TOOLBAR_CALLBACK': lambda _: True, + 'SHOW_TOOLBAR_CALLBACK': 'lms.envs.devstack.should_show_debug_toolbar' } + +def should_show_debug_toolbar(_): + return True # We always want the toolbar on devstack regardless of IP, auth, etc. + + ########################### PIPELINE ################################# PIPELINE_SASS_ARGUMENTS = '--debug-info --require {proj_dir}/static/sass/bourbon/lib/bourbon.rb'.format(proj_dir=PROJECT_ROOT) diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index c58f993fe71..d0f04e52c26 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -118,14 +118,8 @@ ipaddr==2.1.11 # Used to allow to configure CORS headers for cross-domain requests django-cors-headers==0.13 -# We've tried several times to update the debug toolbar to version 1.0.1, -# and had problems each time, resulting in us rolling back to 0.9.4. Before -# submitting another pull request to do this update, check the following: -# * https://github.com/django-debug-toolbar/django-debug-toolbar/issues/535 should be resolved -# * Studio and CMS should both run correctly, both directly and via devstack -# * Check the Javascript console to be sure there are no Javascript errors -# related to the Django debug toolbar -django_debug_toolbar==0.9.4 +# Debug toolbar +django_debug_toolbar==1.2.2 django-debug-toolbar-mongo # Used for testing -- GitLab