aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAymeric Augustin2013-10-27 13:08:19 +0100
committerAymeric Augustin2013-10-27 13:08:19 +0100
commitb979c164789facbaed84728de95300c2d01be61c (patch)
tree7ca44f7842677e93ff7779e5541b2a09980c4196
parentc0bd74252e717c4a93d333467253ef9b5c66dcb5 (diff)
downloaddjango-debug-toolbar-b979c164789facbaed84728de95300c2d01be61c.tar.bz2
Document SQL_WARNING_THRESHOLD.
Fix #429.
-rw-r--r--README.rst5
-rw-r--r--debug_toolbar/utils/settings.py1
-rw-r--r--debug_toolbar/utils/tracking/db.py2
3 files changed, 7 insertions, 1 deletions
diff --git a/README.rst b/README.rst
index 6635837..c99c10f 100644
--- a/README.rst
+++ b/README.rst
@@ -186,6 +186,11 @@ The debug toolbar has two settings that can be set in ``settings.py``:
with client-side frameworks. For example, when using with Angular.js, set
this to 'ng-non-bindable' or 'class="ng-non-bindable"'. Defaults to ''.
+ * ``SQL_WARNING_THRESHOLD``
+
+ The SQL panel highlights queries that took more that this amount of time,
+ in milliseconds, to execute. The default is 500.
+
Example configuration::
def custom_show_toolbar(request):
diff --git a/debug_toolbar/utils/settings.py b/debug_toolbar/utils/settings.py
index 482781b..af9821f 100644
--- a/debug_toolbar/utils/settings.py
+++ b/debug_toolbar/utils/settings.py
@@ -19,6 +19,7 @@ CONFIG_DEFAULTS = {
'debug_toolbar',
),
'ROOT_TAG_ATTRS': '',
+ 'SQL_WARNING_THRESHOLD': 500, # milliseconds
}
diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py
index 7b8092c..dd49e39 100644
--- a/debug_toolbar/utils/tracking/db.py
+++ b/debug_toolbar/utils/tracking/db.py
@@ -135,7 +135,7 @@ class NormalCursorWrapper(object):
'stacktrace': stacktrace,
'start_time': start_time,
'stop_time': stop_time,
- 'is_slow': (duration > CONFIG.get('SQL_WARNING_THRESHOLD', 500)),
+ 'is_slow': duration > CONFIG['SQL_WARNING_THRESHOLD'],
'is_select': sql.lower().strip().startswith('select'),
'template_info': template_info,
}