Skip to content

Commit c74b631

Browse files
committed
Make ProfilingPanal enabled but inactive by default
I believe the ProfilingPanal is disabled by default to avoid interfering with other middleware and panels during profiling. The same can be achieved by making the panel inactive. This makes it easier for users to access the panel without additional configuration but continues to avoid profiling interference.
1 parent 1e46c4e commit c74b631

File tree

5 files changed

+14
-31
lines changed

5 files changed

+14
-31
lines changed

debug_toolbar/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515

1616
CONFIG_DEFAULTS = {
1717
# Toolbar options
18-
"DISABLE_PANELS": {"debug_toolbar.panels.redirects.RedirectsPanel"},
18+
"DISABLE_PANELS": {
19+
"debug_toolbar.panels.profiling.ProfilingPanel",
20+
"debug_toolbar.panels.redirects.RedirectsPanel",
21+
},
1922
"INSERT_BEFORE": "</body>",
2023
"RENDER_PANELS": None,
2124
"RESULTS_CACHE_SIZE": 10,
@@ -126,6 +129,7 @@ def get_config():
126129
"debug_toolbar.panels.signals.SignalsPanel",
127130
"debug_toolbar.panels.logging.LoggingPanel",
128131
"debug_toolbar.panels.redirects.RedirectsPanel",
132+
"debug_toolbar.panels.profiling.ProfilingPanel",
129133
]
130134

131135

docs/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ UNRELEASED
55
----------
66

77
* Updated ``StaticFilesPanel`` to be compatible with Django 3.0.
8+
* The ``ProfilingPanel`` is now enabled but inactive by default.
89

910
1.11 (2018-12-03)
1011
-----------------

docs/panels.rst

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ Since this behavior is annoying when you aren't debugging a redirect, this
105105
panel is included but inactive by default. You can activate it by default with
106106
the ``DISABLE_PANELS`` configuration option.
107107

108-
Non-default built-in panels
109-
---------------------------
110-
111-
The following panels are disabled by default. You must add them to the
112-
``DEBUG_TOOLBAR_PANELS`` setting to enable them.
113-
114108
.. _profiling-panel:
115109

116110
Profiling
@@ -120,13 +114,16 @@ Path: ``debug_toolbar.panels.profiling.ProfilingPanel``
120114

121115
Profiling information for the processing of the request.
122116

117+
This panel is included but inactive by default. You can activate it by default
118+
with the ``DISABLE_PANELS`` configuration option.
119+
123120
If the ``debug_toolbar.middleware.DebugToolbarMiddleware`` is first in
124121
``MIDDLEWARE_CLASSES`` then the other middlewares' ``process_view`` methods
125122
will not be executed. This is because ``ProfilingPanel.process_view`` will
126123
return a ``HttpResponse`` which causes the other middlewares'
127124
``process_view`` methods to be skipped.
128125

129-
If you run into this issues, then you should either disable the
126+
If you run into this issues, then you should either deactivate the
130127
``ProfilingPanel`` or move ``DebugToolbarMiddleware`` to the end of
131128
``MIDDLEWARE_CLASSES``. If you do the latter, then the debug toolbar won't
132129
track the execution of other middleware.

docs/tips.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ you see errors, try a hard browser refresh or clearing your cache.
2121
Middleware isn't working correctly
2222
----------------------------------
2323

24-
Using the Debug Toolbar in its default configuration and with the profiling
25-
panel will cause middlewares after
24+
Using the Debug Toolbar in its default configuration with the profiling panel
25+
active will cause middlewares after
2626
``debug_toolbar.middleware.DebugToolbarMiddleware`` to not execute their
2727
``process_view`` functions. This can be resolved by disabling the profiling
2828
panel or moving the ``DebugToolbarMiddleware`` to the end of
29-
``MIDDLEWARE_CLASSES``. Read more about it at
30-
:ref:`ProfilingPanel <profiling-panel>`
29+
``MIDDLEWARE_CLASSES``. Read more about it at :ref:`ProfilingPanel
30+
<profiling-panel>`
3131

3232
Performance considerations
3333
--------------------------

example/settings.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,4 @@
9595
}
9696
}
9797

98-
99-
# django-debug-toolbar
100-
101-
DEBUG_TOOLBAR_PANELS = [
102-
"debug_toolbar.panels.versions.VersionsPanel",
103-
"debug_toolbar.panels.timer.TimerPanel",
104-
"debug_toolbar.panels.settings.SettingsPanel",
105-
"debug_toolbar.panels.headers.HeadersPanel",
106-
"debug_toolbar.panels.request.RequestPanel",
107-
"debug_toolbar.panels.sql.SQLPanel",
108-
"debug_toolbar.panels.templates.TemplatesPanel",
109-
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
110-
"debug_toolbar.panels.cache.CachePanel",
111-
"debug_toolbar.panels.signals.SignalsPanel",
112-
"debug_toolbar.panels.logging.LoggingPanel",
113-
"debug_toolbar.panels.redirects.RedirectsPanel",
114-
"debug_toolbar.panels.profiling.ProfilingPanel",
115-
]
116-
11798
STATICFILES_DIRS = [os.path.join(BASE_DIR, "example", "static")]

0 commit comments

Comments
 (0)