Skip to content

Commit d413daa

Browse files
committed
Attempt to protect copy-paste-happy programmers from themselves.
Judging by issue 469, "copy-paste whatever piece of code I come across without even reading it and then whine" is a popular programming technique. Since I cannot change significantly this behavior, I'm replacing the configuration example with something harmless but slightly obnoxious and adding a warning that will only ever be read by people who don't need it, in an attempt to dam the flow of complaints.
1 parent 2c5fae5 commit d413daa

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

docs/configuration.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Configuration
44
The debug toolbar provides two settings that you can add in your project's
55
settings module to customize its behavior.
66

7+
.. note:: Do you really need a customized configuration?
8+
9+
The debug toolbar ships with a default configuration that is considered
10+
sane for the vast majority of Django projects. Don't copy-paste blindly
11+
the default values shown below into you settings module! It's useless and
12+
it'll prevent you from taking advantage of better defaults that may be
13+
introduced in future releases.
14+
715
DEBUG_TOOLBAR_PANELS
816
--------------------
917

@@ -154,17 +162,14 @@ Panel options
154162
The SQL panel highlights queries that took more that this amount of time,
155163
in milliseconds, to execute.
156164

157-
Here's an example::
158-
159-
def custom_show_toolbar(request):
160-
return True # Always show toolbar, for example purposes only.
165+
Here's what a slightly customized toolbar configuration might look like::
161166

162-
DEBUG_TOOLBAR_CONFIG = {
167+
# This example is unlikely to be appropriate for your project.
168+
CONFIG_DEFAULTS = {
169+
# Toolbar options
170+
'RESULTS_STORE_SIZE': 3,
171+
'SHOW_COLLAPSED': True,
172+
# Panel options
163173
'INTERCEPT_REDIRECTS': True,
164-
'SHOW_TOOLBAR_CALLBACK': custom_show_toolbar,
165-
'EXTRA_SIGNALS': ['myproject.signals.MySignal'],
166-
'HIDE_DJANGO_SQL': False,
167-
'TAG': 'div',
168-
'ENABLE_STACKTRACES': True,
169-
'HIDE_IN_STACKTRACES': ('gunicorn', 'newrelic'),
174+
'SQL_WARNING_THRESHOLD': 100, # milliseconds
170175
}

0 commit comments

Comments
 (0)