Codebase list python-django-debug-toolbar / e3e16ca
Imported Upstream version 1.6 Andrew Starr-Bochicchio 7 years ago
26 changed file(s) with 551 addition(s) and 436 deletion(s). Raw diff Collapse all Expand all
0 [run]
1 source = debug_toolbar
2 branch = 1
3
4 [report]
5 omit = *tests*,*migrations*
00 language: python
11 sudo: false
2 python:
3 - "2.7"
4 - "3.3"
5 - "3.4"
6 - "3.5"
2 python: 3.5
3 cache: pip
74 env:
8 - DJANGO="Django>=1.8.0,<1.9.0"
9 - DJANGO="Django>=1.9.0,<1.10.0"
10 - DJANGO="Django>=1.10a,<1.11.0"
11 matrix:
12 exclude:
13 - python: "3.3"
14 env: DJANGO="Django>=1.9.0,<1.10.0"
15 - python: "3.3"
16 env: DJANGO="Django>=1.10a,<1.11.0"
17 - python: "3.5"
18 env: DJANGO="Django>=1.8.0,<1.9.0"
5 - TOXENV="py27-dj18"
6 - TOXENV="py33-dj18"
7 - TOXENV="py34-dj18"
8 - TOXENV="py27-dj19"
9 - TOXENV="py27-dj110"
10 - TOXENV="py34-dj19"
11 - TOXENV="py34-dj110"
12 - TOXENV="py35-dj19"
13 - TOXENV="py35-dj110"
14 - TOXENV="flake8"
15 - TOXENV="isort"
16 - TOXENV="readme"
1917 install:
20 - travis_retry pip install sqlparse
21 - travis_retry pip install --pre $DJANGO
22 - pip install -e .
18 - pip install tox codecov
2319 script:
24 - make jshint
25 - make test
20 - tox -v
21 after_success:
22 - codecov
0 [![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/)
1
2 This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines).
3
4 Please see the
5 [full contributing documentation](https://django-debug-toolbar.readthedocs.io/en/stable/contributing.html)
6 for more help.
00 include LICENSE
11 include README.rst
2 include CONTRIBUTING.md
23 recursive-include debug_toolbar/locale *
34 recursive-include debug_toolbar/static *
45 recursive-include debug_toolbar/templates *
2727 django-admin test tests
2828
2929 coverage:
30 python --version
3031 coverage erase
3132 DJANGO_SETTINGS_MODULE=tests.settings \
32 coverage run --branch --source=debug_toolbar `which django-admin` test tests
33 coverage run `which django-admin` test -v2 tests
34 coverage report
3335 coverage html
3436
3537 translatable_strings:
11 Django Debug Toolbar
22 ====================
33
4 .. image:: https://secure.travis-ci.org/django-debug-toolbar/django-debug-toolbar.png
5 :alt: Build Status
6 :target: http://travis-ci.org/django-debug-toolbar/django-debug-toolbar
4 .. image:: https://jazzband.co/static/img/badge.svg
5 :target: https://jazzband.co/
6 :alt: Jazzband
7
8 .. image:: https://travis-ci.org/jazzband/django-debug-toolbar.svg?branch=master
9 :target: https://travis-ci.org/jazzband/django-debug-toolbar
10 :alt: Build Status
11
12 .. image:: https://codecov.io/gh/jazzband/django-debug-toolbar/branch/master/graph/badge.svg
13 :target: https://codecov.io/gh/jazzband/django-debug-toolbar
14 :alt: Test coverage status
15
16 .. image:: https://requires.io/github/jazzband/django-debug-toolbar/requirements.svg?branch=master
17 :target: https://requires.io/github/jazzband/django-debug-toolbar/requirements/?branch=master
18 :alt: Requirements Status
719
820 The Django Debug Toolbar is a configurable set of panels that display various
921 debug information about the current request/response and when clicked, display
1123
1224 Here's a screenshot of the toolbar in action:
1325
14 .. image:: https://raw.github.com/django-debug-toolbar/django-debug-toolbar/master/example/django-debug-toolbar.png
26 .. image:: https://raw.github.com/jazzband/django-debug-toolbar/master/example/django-debug-toolbar.png
1527 :width: 908
1628 :height: 557
1729
1830 In addition to the built-in panels, a number of third-party panels are
1931 contributed by the community.
2032
21 The current version of the Debug Toolbar is 1.5 (in development). It works
22 on Django ≥ 1.8.
33 The current version of the Debug Toolbar is 1.6. It works on Django ≥ 1.8.
2334
2435 Documentation, including installation and configuration instructions, is
2536 available at https://django-debug-toolbar.readthedocs.io/.
3041 The Django Debug Toolbar was originally created by Rob Hudson <rob@cogit8.org>
3142 in August 2008 and was further developed by many contributors_.
3243
33 .. _contributors: https://github.com/django-debug-toolbar/django-debug-toolbar/graphs/contributors
44 .. _contributors: https://github.com/jazzband/django-debug-toolbar/graphs/contributors
00 from __future__ import absolute_import, unicode_literals
11
2 import inspect
3
24 from django.apps import AppConfig
5 from django.conf import settings
6 from django.core.checks import Error, register
7 from django.middleware.gzip import GZipMiddleware
8 from django.utils.module_loading import import_string
39 from django.utils.translation import ugettext_lazy as _
410
5 from debug_toolbar import settings as dt_settings
11 from debug_toolbar.middleware import DebugToolbarMiddleware
612
713
814 class DebugToolbarConfig(AppConfig):
915 name = 'debug_toolbar'
1016 verbose_name = _("Debug Toolbar")
1117
12 def ready(self):
13 if dt_settings.get_patch_settings():
14 dt_settings.patch_all()
15 dt_settings.check_middleware()
18
19 @register
20 def check_middleware(app_configs, **kwargs):
21 errors = []
22 gzip_index = None
23 debug_toolbar_index = None
24
25 setting = getattr(settings, 'MIDDLEWARE', None)
26 setting_name = 'MIDDLEWARE'
27 if setting is None:
28 setting = settings.MIDDLEWARE_CLASSES
29 setting_name = 'MIDDLEWARE_CLASSES'
30
31 # Determine the indexes which gzip and/or the toolbar are installed at
32 for i, middleware in enumerate(setting):
33 if is_middleware_class(GZipMiddleware, middleware):
34 gzip_index = i
35 elif is_middleware_class(DebugToolbarMiddleware, middleware):
36 debug_toolbar_index = i
37
38 if debug_toolbar_index is None:
39 # If the toolbar does not appear, report an error.
40 errors.append(
41 Error(
42 "debug_toolbar.middleware.DebugToolbarMiddleware is missing "
43 "from %s." % setting_name,
44 hint="Add debug_toolbar.middleware.DebugToolbarMiddleware to "
45 "%s." % setting_name,
46 )
47 )
48 elif gzip_index is not None and debug_toolbar_index < gzip_index:
49 # If the toolbar appears before the gzip index, report an error.
50 errors.append(
51 Error(
52 "debug_toolbar.middleware.DebugToolbarMiddleware occurs before "
53 "django.middleware.gzip.GZipMiddleware in %s." % setting_name,
54 hint="Move debug_toolbar.middleware.DebugToolbarMiddleware to "
55 "after django.middleware.gzip.GZipMiddleware in %s." % setting_name,
56 )
57 )
58
59 return errors
60
61
62 def is_middleware_class(middleware_class, middleware_path):
63 try:
64 middleware_cls = import_string(middleware_path)
65 except ImportError:
66 return
67 return (
68 inspect.isclass(middleware_cls) and
69 issubclass(middleware_cls, middleware_class)
70 )
00 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
11 # This file is distributed under the same license as the PACKAGE package.
2 #
3 #
2 #
3 #
44 # Translators:
55 # Ilya Baryshev <baryshev@gmail.com>, 2013
66 # Mikhail Korobov, 2009
99 msgstr ""
1010 "Project-Id-Version: Django Debug Toolbar\n"
1111 "Report-Msgid-Bugs-To: \n"
12 "POT-Creation-Date: 2014-04-25 21:52+0200\n"
13 "PO-Revision-Date: 2014-04-25 19:53+0000\n"
14 "Last-Translator: Aymeric Augustin <aymeric.augustin@m4x.org>\n"
15 "Language-Team: Russian (http://www.transifex.com/projects/p/django-debug-toolbar/language/ru/)\n"
12 "POT-Creation-Date: 2016-07-21 16:45+0600\n"
13 "PO-Revision-Date: 2016-07-21 17:22+0600\n"
14 "Last-Translator: Igor 'idle sign' Starikov <idlesign@yandex.ru>\n"
15 "Language-Team: Russian (http://www.transifex.com/projects/p/django-debug-"
16 "toolbar/language/ru/)\n"
17 "Language: ru\n"
1618 "MIME-Version: 1.0\n"
1719 "Content-Type: text/plain; charset=UTF-8\n"
1820 "Content-Transfer-Encoding: 8bit\n"
19 "Language: ru\n"
20 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
21 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
22 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
23 "X-Generator: Poedit 1.8.7.1\n"
2124
2225 #: apps.py:11
2326 msgid "Debug Toolbar"
24 msgstr ""
25
26 #: views.py:14
27 msgid ""
28 "Data for this panel isn't available anymore. Please reload the page and "
29 "retry."
30 msgstr "Данные этой панели больше недоступны. Пожалуйста, перезагрузите страницу и попробуйте ещё раз."
31
32 #: panels/cache.py:191
27 msgstr "Отладочная панель"
28
29 #: panels/cache.py:204
3330 msgid "Cache"
34 msgstr "Кэш"
35
36 #: panels/cache.py:196
31 msgstr "Кеш"
32
33 #: panels/cache.py:209
3734 #, python-format
3835 msgid "%(cache_calls)d call in %(time).2fms"
3936 msgid_plural "%(cache_calls)d calls in %(time).2fms"
40 msgstr[0] "%(cache_calls)d обращение за %(time).2fms"
41 msgstr[1] "%(cache_calls)d обращения за %(time).2fms"
42 msgstr[2] "%(cache_calls)d обращений за %(time).2fms"
43
44 #: panels/cache.py:204
37 msgstr[0] "%(cache_calls)d обращение за %(time).2f мс"
38 msgstr[1] "%(cache_calls)d обращения за %(time).2f мс"
39 msgstr[2] "%(cache_calls)d обращений за %(time).2f мс"
40
41 #: panels/cache.py:217
4542 #, python-format
4643 msgid "Cache calls from %(count)d backend"
4744 msgid_plural "Cache calls from %(count)d backends"
48 msgstr[0] "Обращения к кэшу от %(count)d бэкенда"
49 msgstr[1] "Обращения к кэшу от %(count)d бэкендов"
50 msgstr[2] "Обращения к кэшу от %(count)d бэкендов"
51
52 #: panels/headers.py:35
45 msgstr[0] "Обращения к кешу от %(count)d бэкенда"
46 msgstr[1] "Обращения к кешу от %(count)d бэкендов"
47 msgstr[2] "Обращения к кешу от %(count)d бэкендов"
48
49 #: panels/headers.py:34
5350 msgid "Headers"
5451 msgstr "Заголовки"
5552
56 #: panels/logging.py:64
53 #: panels/logging.py:66
5754 msgid "Logging"
5855 msgstr "Логи"
5956
60 #: panels/logging.py:70
57 #: panels/logging.py:72
6158 #, python-format
6259 msgid "%(count)s message"
6360 msgid_plural "%(count)s messages"
6562 msgstr[1] "%(count)s сообщений"
6663 msgstr[2] "%(count)s сообщений"
6764
68 #: panels/logging.py:73
65 #: panels/logging.py:75
6966 msgid "Log messages"
7067 msgstr "Сообщения в логе"
7168
72 #: panels/profiling.py:127
69 #: panels/profiling.py:144
7370 msgid "Profiling"
7471 msgstr "Профилирование"
7572
76 #: panels/redirects.py:17
73 #: panels/redirects.py:16
7774 msgid "Intercept redirects"
78 msgstr "Перехват редиректов"
75 msgstr "Перехватывать перенаправления"
7976
8077 #: panels/request.py:18
8178 msgid "Request"
8380
8481 #: panels/request.py:35
8582 msgid "<no view>"
86 msgstr "<нет view>"
83 msgstr "<нет представления>"
8784
8885 #: panels/request.py:47
8986 msgid "<unavailable>"
9087 msgstr "<недоступно>"
9188
92 #: panels/settings.py:20
89 #: panels/settings.py:18
9390 msgid "Settings"
9491 msgstr "Настройки"
9592
96 #: panels/settings.py:23
93 #: panels/settings.py:21
9794 #, python-format
9895 msgid "Settings from <code>%s</code>"
9996 msgstr "Настройки из <code>%s</code>"
10097
101 #: panels/signals.py:45
98 #: panels/signals.py:44
10299 #, python-format
103100 msgid "%(num_receivers)d receiver of 1 signal"
104101 msgid_plural "%(num_receivers)d receivers of 1 signal"
106103 msgstr[1] "%(num_receivers)d получателя 1 сигнала"
107104 msgstr[2] "%(num_receivers)d получателей 1 сигнала"
108105
109 #: panels/signals.py:48
106 #: panels/signals.py:47
110107 #, python-format
111108 msgid "%(num_receivers)d receiver of %(num_signals)d signals"
112109 msgid_plural "%(num_receivers)d receivers of %(num_signals)d signals"
114111 msgstr[1] "%(num_receivers)d получателя %(num_signals)d сигнала(ов)"
115112 msgstr[2] "%(num_receivers)d получателей %(num_signals)d сигнала(ов)"
116113
117 #: panels/signals.py:53
114 #: panels/signals.py:52
118115 msgid "Signals"
119116 msgstr "Сигналы"
120117
121 #: panels/staticfiles.py:89
118 #: panels/sql/panel.py:25
119 msgid "Autocommit"
120 msgstr "Autocommit"
121
122 #: panels/sql/panel.py:26
123 msgid "Read uncommitted"
124 msgstr "Read uncommitted"
125
126 #: panels/sql/panel.py:27
127 msgid "Read committed"
128 msgstr "Read committed"
129
130 #: panels/sql/panel.py:28
131 msgid "Repeatable read"
132 msgstr "Repeatable read"
133
134 #: panels/sql/panel.py:29
135 msgid "Serializable"
136 msgstr "Сериализуемый"
137
138 #: panels/sql/panel.py:40
139 msgid "Idle"
140 msgstr "Ожидание"
141
142 #: panels/sql/panel.py:41
143 msgid "Active"
144 msgstr "Действие"
145
146 #: panels/sql/panel.py:42
147 msgid "In transaction"
148 msgstr "В транзакции"
149
150 #: panels/sql/panel.py:43
151 msgid "In error"
152 msgstr "Ошибка"
153
154 #: panels/sql/panel.py:44
155 msgid "Unknown"
156 msgstr "Неизвестно"
157
158 #: panels/sql/panel.py:108
159 msgid "SQL"
160 msgstr "SQL"
161
162 #: panels/staticfiles.py:87
122163 #, python-format
123164 msgid "Static files (%(num_found)s found, %(num_used)s used)"
124 msgstr ""
125
126 #: panels/staticfiles.py:107
165 msgstr "Файлов статики (вего: %(num_found)s, использовано: %(num_used)s)"
166
167 #: panels/staticfiles.py:105
127168 msgid "Static files"
128 msgstr ""
129
130 #: panels/staticfiles.py:112
169 msgstr "Статика"
170
171 #: panels/staticfiles.py:110
131172 #, python-format
132173 msgid "%(num_used)s file used"
133174 msgid_plural "%(num_used)s files used"
134 msgstr[0] ""
135 msgstr[1] ""
136 msgstr[2] ""
137
138 #: panels/timer.py:23
175 msgstr[0] "%(num_used)s файл используется"
176 msgstr[1] "%(num_used)s файла используются"
177 msgstr[2] "%(num_used)s файлов используются"
178
179 #: panels/templates/panel.py:128
180 msgid "Templates"
181 msgstr "Шаблоны"
182
183 #: panels/templates/panel.py:133
184 #, python-format
185 msgid "Templates (%(num_templates)s rendered)"
186 msgstr "Шаблоны (обработано %(num_templates)s)"
187
188 #: panels/templates/panel.py:164
189 msgid "No origin"
190 msgstr "Нет источника"
191
192 #: panels/timer.py:26
139193 #, python-format
140194 msgid "CPU: %(cum)0.2fms (%(total)0.2fms)"
141 msgstr "CPU: %(cum)0.2fms (%(total)0.2fms)"
142
143 #: panels/timer.py:28
195 msgstr "CPU: %(cum)0.2f мс (%(total)0.2f мс)"
196
197 #: panels/timer.py:31
144198 #, python-format
145199 msgid "Total: %0.2fms"
146 msgstr "Итого: %0.2fms"
147
148 #: panels/timer.py:34 templates/debug_toolbar/panels/logging.html:7
200 msgstr "Итого: %0.2f мс"
201
202 #: panels/timer.py:37 templates/debug_toolbar/panels/logging.html:7
149203 #: templates/debug_toolbar/panels/sql_explain.html:11
150204 #: templates/debug_toolbar/panels/sql_profile.html:12
151205 #: templates/debug_toolbar/panels/sql_select.html:11
152206 msgid "Time"
153207 msgstr "Время"
154208
155 #: panels/timer.py:42
209 #: panels/timer.py:45
156210 msgid "User CPU time"
157 msgstr "User CPU time"
158
159 #: panels/timer.py:42
211 msgstr "Пользовательское время ядра"
212
213 #: panels/timer.py:45
160214 #, python-format
161215 msgid "%(utime)0.3f msec"
162216 msgstr "%(utime)0.3f мс"
163217
164 #: panels/timer.py:43
218 #: panels/timer.py:46
165219 msgid "System CPU time"
166 msgstr "System CPU time"
167
168 #: panels/timer.py:43
220 msgstr "Системное время ядра"
221
222 #: panels/timer.py:46
169223 #, python-format
170224 msgid "%(stime)0.3f msec"
171225 msgstr "%(stime)0.3f мс"
172226
173 #: panels/timer.py:44
227 #: panels/timer.py:47
174228 msgid "Total CPU time"
175 msgstr "Total CPU time"
176
177 #: panels/timer.py:44
229 msgstr "Общее время ядра"
230
231 #: panels/timer.py:47
178232 #, python-format
179233 msgid "%(total)0.3f msec"
180234 msgstr "%(total)0.3f мс"
181235
182 #: panels/timer.py:45
236 #: panels/timer.py:48
183237 msgid "Elapsed time"
184238 msgstr "Затраченное время"
185239
186 #: panels/timer.py:45
240 #: panels/timer.py:48
187241 #, python-format
188242 msgid "%(total_time)0.3f msec"
189243 msgstr "%(total_time)0.3f мс"
190244
191 #: panels/timer.py:46
245 #: panels/timer.py:49
192246 msgid "Context switches"
193 msgstr "Переключений контекста"
194
195 #: panels/timer.py:46
247 msgstr "Переключения контекста"
248
249 #: panels/timer.py:49
196250 #, python-format
197251 msgid "%(vcsw)d voluntary, %(ivcsw)d involuntary"
198252 msgstr "%(vcsw)d намеренных, %(ivcsw)d вынужденных"
199253
200 #: panels/versions.py:25
254 #: panels/versions.py:20
201255 msgid "Versions"
202256 msgstr "Версии"
203
204 #: panels/sql/panel.py:22
205 msgid "Autocommit"
206 msgstr "Autocommit"
207
208 #: panels/sql/panel.py:23
209 msgid "Read uncommitted"
210 msgstr "Read uncommitted"
211
212 #: panels/sql/panel.py:24
213 msgid "Read committed"
214 msgstr "Read committed"
215
216 #: panels/sql/panel.py:25
217 msgid "Repeatable read"
218 msgstr "Repeatable read"
219
220 #: panels/sql/panel.py:26
221 msgid "Serializable"
222 msgstr "Serializable"
223
224 #: panels/sql/panel.py:37
225 msgid "Idle"
226 msgstr "Ожидание"
227
228 #: panels/sql/panel.py:38
229 msgid "Active"
230 msgstr "Действие"
231
232 #: panels/sql/panel.py:39
233 msgid "In transaction"
234 msgstr "В транзакции"
235
236 #: panels/sql/panel.py:40
237 msgid "In error"
238 msgstr "Ошибка"
239
240 #: panels/sql/panel.py:41
241 msgid "Unknown"
242 msgstr "Неизвестно"
243
244 #: panels/sql/panel.py:105
245 msgid "SQL"
246 msgstr "SQL"
247
248 #: panels/templates/panel.py:141
249 msgid "Templates"
250 msgstr "Шаблоны"
251
252 #: panels/templates/panel.py:146
253 #, python-format
254 msgid "Templates (%(num_templates)s rendered)"
255 msgstr "Шаблоны (обработано %(num_templates)s)"
256257
257258 #: templates/debug_toolbar/base.html:19
258259 msgid "Hide toolbar"
274275 msgid "Show toolbar"
275276 msgstr "Показать панель"
276277
277 #: templates/debug_toolbar/base.html:53
278 msgid "Close"
279 msgstr "Закрыть"
280
281 #: templates/debug_toolbar/redirect.html:8
282 msgid "Location:"
283 msgstr ""
284
285 #: templates/debug_toolbar/redirect.html:10
286 msgid ""
287 "The Django Debug Toolbar has intercepted a redirect to the above URL for "
288 "debug viewing purposes. You can click the above link to continue with the "
289 "redirect as normal."
290 msgstr "Django Debug Toolbar в перехватил редирект на адрес, указанный выше. Вы можете нажать на ссылку, чтобы выполнить переход самостоятельно."
291
292278 #: templates/debug_toolbar/panels/cache.html:2
293279 msgid "Summary"
294280 msgstr "Сводка"
303289
304290 #: templates/debug_toolbar/panels/cache.html:8
305291 msgid "Cache hits"
306 msgstr "Cache хитов"
292 msgstr "Попадания"
307293
308294 #: templates/debug_toolbar/panels/cache.html:9
309295 msgid "Cache misses"
310 msgstr "Промахи кэша"
296 msgstr "Промахи"
311297
312298 #: templates/debug_toolbar/panels/cache.html:21
313299 msgid "Commands"
318304 msgstr "Вызовы"
319305
320306 #: templates/debug_toolbar/panels/cache.html:43
321 #: templates/debug_toolbar/panels/sql.html:20
307 #: templates/debug_toolbar/panels/sql.html:23
322308 msgid "Time (ms)"
323309 msgstr "Время (мс)"
324310
374360 msgid ""
375361 "Since the WSGI environ inherits the environment of the server, only a "
376362 "significant subset is shown below."
377 msgstr "Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те из переменных, которые важны для нужд отладки."
363 msgstr ""
364 "Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те "
365 "из переменных, которые важны для нужд отладки."
378366
379367 #: templates/debug_toolbar/panels/logging.html:6
380368 msgid "Level"
389377 msgstr "Сообщение"
390378
391379 #: templates/debug_toolbar/panels/logging.html:10
392 #: templates/debug_toolbar/panels/staticfiles.html:45
380 #: templates/debug_toolbar/panels/staticfiles.html:44
393381 msgid "Location"
394382 msgstr "Место"
395383
420408
421409 #: templates/debug_toolbar/panels/request.html:3
422410 msgid "View information"
423 msgstr "View"
411 msgstr "Информация о представлении"
424412
425413 #: templates/debug_toolbar/panels/request.html:7
426414 msgid "View function"
427 msgstr "View функция"
415 msgstr "Функция представления"
428416
429417 #: templates/debug_toolbar/panels/request.html:10
430418 msgid "URL name"
431 msgstr "URL Name"
419 msgstr "Имя URL"
432420
433421 #: templates/debug_toolbar/panels/request.html:24
434422 msgid "Cookies"
435 msgstr "Cookies"
423 msgstr "Куки"
436424
437425 #: templates/debug_toolbar/panels/request.html:32
438426 #: templates/debug_toolbar/panels/request.html:58
443431
444432 #: templates/debug_toolbar/panels/request.html:46
445433 msgid "No cookies"
446 msgstr "Нет cookies"
434 msgstr "Нет куков"
447435
448436 #: templates/debug_toolbar/panels/request.html:50
449437 msgid "Session data"
479467
480468 #: templates/debug_toolbar/panels/signals.html:6
481469 msgid "Providing"
482 msgstr ""
470 msgstr "Аргументы"
483471
484472 #: templates/debug_toolbar/panels/signals.html:7
485473 msgid "Receivers"
493481 msgstr[1] "%(num)s запроса"
494482 msgstr[2] "%(num)s запросов"
495483
496 #: templates/debug_toolbar/panels/sql.html:18
484 #: templates/debug_toolbar/panels/sql.html:9
485 #, python-format
486 msgid "including %(dupes)s duplicates"
487 msgstr "включая дублей: %(dupes)s"
488
489 #: templates/debug_toolbar/panels/sql.html:21
497490 msgid "Query"
498491 msgstr "Запрос"
499492
500 #: templates/debug_toolbar/panels/sql.html:19
493 #: templates/debug_toolbar/panels/sql.html:22
501494 #: templates/debug_toolbar/panels/timer.html:36
502495 msgid "Timeline"
503496 msgstr "Временная диаграмма"
504497
505 #: templates/debug_toolbar/panels/sql.html:21
498 #: templates/debug_toolbar/panels/sql.html:24
506499 msgid "Action"
507500 msgstr "Действие"
508501
509 #: templates/debug_toolbar/panels/sql.html:64
502 #: templates/debug_toolbar/panels/sql.html:41
503 #, python-format
504 msgid "Duplicated %(dupes)s times."
505 msgstr "Дублей: %(dupes)s."
506
507 #: templates/debug_toolbar/panels/sql.html:73
510508 msgid "Connection:"
511509 msgstr "Соединение:"
512510
513 #: templates/debug_toolbar/panels/sql.html:66
511 #: templates/debug_toolbar/panels/sql.html:75
514512 msgid "Isolation level:"
515513 msgstr "Уровень изоляции:"
516514
517 #: templates/debug_toolbar/panels/sql.html:69
515 #: templates/debug_toolbar/panels/sql.html:78
518516 msgid "Transaction status:"
519517 msgstr "Статус транзакции:"
520518
521 #: templates/debug_toolbar/panels/sql.html:83
519 #: templates/debug_toolbar/panels/sql.html:92
522520 msgid "(unknown)"
523521 msgstr "(неизвестно)"
524522
525 #: templates/debug_toolbar/panels/sql.html:92
523 #: templates/debug_toolbar/panels/sql.html:101
526524 msgid "No SQL queries were recorded during this request."
527 msgstr "Во время обработки этого HTTP-запроса не было записано ни одного SQL-запроса."
528
529 #: templates/debug_toolbar/panels/sql_explain.html:3
530 #: templates/debug_toolbar/panels/sql_profile.html:3
531 #: templates/debug_toolbar/panels/sql_select.html:3
532 #: templates/debug_toolbar/panels/template_source.html:3
533 msgid "Back"
534 msgstr "Назад"
525 msgstr ""
526 "Во время обработки этого HTTP-запроса не было записано ни одного SQL-запроса."
535527
536528 #: templates/debug_toolbar/panels/sql_explain.html:4
537529 msgid "SQL explained"
565557 msgid "Empty set"
566558 msgstr "Ничего, ноль строк"
567559
568 #: templates/debug_toolbar/panels/staticfiles.html:4
560 #: templates/debug_toolbar/panels/staticfiles.html:3
569561 msgid "Static file path"
570562 msgid_plural "Static file paths"
571 msgstr[0] ""
572 msgstr[1] ""
573 msgstr[2] ""
574
575 #: templates/debug_toolbar/panels/staticfiles.html:8
563 msgstr[0] "Путь к статике"
564 msgstr[1] "Пути к статике"
565 msgstr[2] "Пути к статике"
566
567 #: templates/debug_toolbar/panels/staticfiles.html:7
576568 #, python-format
577569 msgid "(prefix %(prefix)s)"
578 msgstr ""
579
580 #: templates/debug_toolbar/panels/staticfiles.html:12
581 #: templates/debug_toolbar/panels/staticfiles.html:23
582 #: templates/debug_toolbar/panels/staticfiles.html:35
570 msgstr "(префикс %(prefix)s)"
571
572 #: templates/debug_toolbar/panels/staticfiles.html:11
573 #: templates/debug_toolbar/panels/staticfiles.html:22
574 #: templates/debug_toolbar/panels/staticfiles.html:34
583575 #: templates/debug_toolbar/panels/templates.html:10
584576 #: templates/debug_toolbar/panels/templates.html:28
585577 #: templates/debug_toolbar/panels/templates.html:43
586578 msgid "None"
587579 msgstr "Нет"
588580
589 #: templates/debug_toolbar/panels/staticfiles.html:15
581 #: templates/debug_toolbar/panels/staticfiles.html:14
590582 msgid "Static file app"
591583 msgid_plural "Static file apps"
592 msgstr[0] ""
593 msgstr[1] ""
594 msgstr[2] ""
595
596 #: templates/debug_toolbar/panels/staticfiles.html:26
584 msgstr[0] "Приложение со статикой"
585 msgstr[1] "Приложения со статикой"
586 msgstr[2] "Приложения со статикой"
587
588 #: templates/debug_toolbar/panels/staticfiles.html:25
597589 msgid "Static file"
598590 msgid_plural "Static files"
599 msgstr[0] ""
600 msgstr[1] ""
601 msgstr[2] ""
602
603 #: templates/debug_toolbar/panels/staticfiles.html:40
591 msgstr[0] "Файл статики"
592 msgstr[1] "Файлы статики"
593 msgstr[2] "Файлы статики"
594
595 #: templates/debug_toolbar/panels/staticfiles.html:39
604596 #, python-format
605597 msgid "%(payload_count)s file"
606598 msgid_plural "%(payload_count)s files"
607 msgstr[0] ""
608 msgstr[1] ""
609 msgstr[2] ""
610
611 #: templates/debug_toolbar/panels/staticfiles.html:44
599 msgstr[0] "%(payload_count)s файл"
600 msgstr[1] "%(payload_count)s файла"
601 msgstr[2] "%(payload_count)s файлов"
602
603 #: templates/debug_toolbar/panels/staticfiles.html:43
612604 msgid "Path"
613 msgstr ""
605 msgstr "Путь"
614606
615607 #: templates/debug_toolbar/panels/template_source.html:4
616608 msgid "Template source:"
662654 msgid "Milliseconds since navigation start (+length)"
663655 msgstr "С начала навигации в мс (+продолжительность)"
664656
665 #: templates/debug_toolbar/panels/versions.html:5
657 #: templates/debug_toolbar/panels/versions.html:7
658 msgid "Package"
659 msgstr "Пакет"
660
661 #: templates/debug_toolbar/panels/versions.html:8
666662 msgid "Name"
667663 msgstr "Название"
668664
669 #: templates/debug_toolbar/panels/versions.html:6
665 #: templates/debug_toolbar/panels/versions.html:9
670666 msgid "Version"
671667 msgstr "Версия"
668
669 #: templates/debug_toolbar/redirect.html:8
670 msgid "Location:"
671 msgstr "Место:"
672
673 #: templates/debug_toolbar/redirect.html:10
674 msgid ""
675 "The Django Debug Toolbar has intercepted a redirect to the above URL for "
676 "debug viewing purposes. You can click the above link to continue with the "
677 "redirect as normal."
678 msgstr ""
679 "Django Debug Toolbar перехватил перенаправление на адрес, указанный выше. Вы "
680 "можете нажать на ссылку, чтобы выполнить переход самостоятельно."
681
682 #: views.py:14
683 msgid ""
684 "Data for this panel isn't available anymore. Please reload the page and "
685 "retry."
686 msgstr ""
687 "Данные этой панели больше недоступны. Пожалуйста, перезагрузите страницу и "
688 "попробуйте ещё раз."
689
690 #~ msgid "Close"
691 #~ msgstr "Закрыть"
692
693 #~ msgid "Back"
694 #~ msgstr "Назад"
99 from django.conf import settings
1010 from django.utils import six
1111 from django.utils.encoding import force_text
12 from django.utils.functional import cached_property
1213 from django.utils.module_loading import import_string
1314
1415 from debug_toolbar import settings as dt_settings
1516 from debug_toolbar.toolbar import DebugToolbar
17
18 try:
19 from django.utils.deprecation import MiddlewareMixin
20 except ImportError: # Django < 1.10
21 # Works perfectly for everyone using MIDDLEWARE_CLASSES
22 MiddlewareMixin = object
23
1624
1725 _HTML_TYPES = ('text/html', 'application/xhtml+xml')
1826
3038 return bool(settings.DEBUG)
3139
3240
33 class DebugToolbarMiddleware(object):
41 class DebugToolbarMiddleware(MiddlewareMixin):
3442 """
3543 Middleware to set up Debug Toolbar on incoming request and render toolbar
3644 on outgoing response.
3745 """
3846 debug_toolbars = {}
3947
40 def __init__(self):
48 @cached_property
49 def show_toolbar(self):
4150 # If SHOW_TOOLBAR_CALLBACK is a string, which is the recommended
4251 # setup, resolve it to the corresponding callable.
4352 func_or_path = dt_settings.get_config()['SHOW_TOOLBAR_CALLBACK']
4453 if isinstance(func_or_path, six.string_types):
45 self.show_toolbar = import_string(func_or_path)
54 return import_string(func_or_path)
4655 else:
47 self.show_toolbar = func_or_path
56 return func_or_path
4857
4958 def process_request(self, request):
5059 # Decide whether the toolbar is active for this request.
00 from __future__ import absolute_import, unicode_literals
11
22 import sys
3 from collections import OrderedDict
43
54 import django
65 from django.apps import apps
2322
2423 def generate_stats(self, request, response):
2524 versions = [
26 ('Python', '%d.%d.%d' % sys.version_info[:3]),
27 ('Django', self.get_app_version(django)),
25 ('Python', '', '%d.%d.%d' % sys.version_info[:3]),
26 ('Django', '', self.get_app_version(django)),
2827 ]
2928 versions += list(self.gen_app_versions())
3029 self.record_stats({
31 'versions': OrderedDict(sorted(versions, key=lambda v: v[0])),
30 'versions': sorted(versions, key=lambda v: v[0]),
3231 'paths': sys.path,
3332 })
3433
3837 app = app_config.module
3938 version = self.get_app_version(app)
4039 if version:
41 yield name, version
40 yield app.__name__, name, version
4241
4342 def get_app_version(self, app):
4443 if hasattr(app, 'get_version'):
00 from __future__ import absolute_import, unicode_literals
11
22 import warnings
3 from importlib import import_module
43
54 from django.conf import settings
65 from django.utils import six
76 from django.utils.lru_cache import lru_cache
8 from django.utils.module_loading import import_string
97
108 # Always import this module as follows:
119 # from debug_toolbar import settings [as dt_settings]
156154 "setting." % (old_panel, new_panel), DeprecationWarning)
157155 PANELS[index] = new_panel
158156 return PANELS
159
160
161 @lru_cache()
162 def get_patch_settings():
163 return getattr(settings, 'DEBUG_TOOLBAR_PATCH_SETTINGS', settings.DEBUG)
164
165
166 # The following functions can monkey-patch settings automatically. Several
167 # imports are placed inside functions to make it safe to import this module.
168
169
170 def check_middleware():
171 from django.middleware.gzip import GZipMiddleware
172 from debug_toolbar.middleware import DebugToolbarMiddleware
173 gzip_index = None
174 debug_toolbar_index = None
175
176 # Determine the indexes which gzip and/or the toolbar are installed at
177 for i, middleware in enumerate(settings.MIDDLEWARE_CLASSES):
178 if is_middleware_class(GZipMiddleware, middleware):
179 gzip_index = i
180 elif is_middleware_class(DebugToolbarMiddleware, middleware):
181 debug_toolbar_index = i
182 # If the toolbar appears before the gzip index, raise a warning
183 if gzip_index is not None and debug_toolbar_index < gzip_index:
184 warnings.warn(
185 "Please use an explicit setup with the "
186 "debug_toolbar.middleware.DebugToolbarMiddleware "
187 "after django.middleware.gzip.GZipMiddlware "
188 "in MIDDLEWARE_CLASSES.", Warning)
189
190
191 def is_middleware_class(middleware_class, middleware_path):
192 try:
193 middleware_cls = import_string(middleware_path)
194 except ImportError:
195 return
196 return issubclass(middleware_cls, middleware_class)
197
198
199 def is_toolbar_middleware_installed():
200 from debug_toolbar.middleware import DebugToolbarMiddleware
201 return any(is_middleware_class(DebugToolbarMiddleware, middleware)
202 for middleware in settings.MIDDLEWARE_CLASSES)
203
204
205 def prepend_to_setting(setting_name, value):
206 """Insert value at the beginning of a list or tuple setting."""
207 values = getattr(settings, setting_name)
208 # Make a list [value] or tuple (value,)
209 value = type(values)((value,))
210 setattr(settings, setting_name, value + values)
211
212
213 def patch_internal_ips():
214 if not settings.INTERNAL_IPS:
215 prepend_to_setting('INTERNAL_IPS', '127.0.0.1')
216 prepend_to_setting('INTERNAL_IPS', '::1')
217
218
219 def patch_middleware_classes():
220 if not is_toolbar_middleware_installed():
221 prepend_to_setting('MIDDLEWARE_CLASSES',
222 'debug_toolbar.middleware.DebugToolbarMiddleware')
223
224
225 def patch_root_urlconf():
226 from django.conf.urls import include, url
227 from django.core.urlresolvers import clear_url_caches, reverse, NoReverseMatch
228 import debug_toolbar
229 try:
230 reverse('djdt:render_panel')
231 except NoReverseMatch:
232 urlconf_module = import_module(settings.ROOT_URLCONF)
233 urlconf_module.urlpatterns = [
234 url(r'^__debug__/', include(debug_toolbar.urls)),
235 ] + urlconf_module.urlpatterns
236 clear_url_caches()
237
238
239 def patch_all():
240 patch_internal_ips()
241 patch_middleware_classes()
242 patch_root_urlconf()
212212 $('#djDebugToolbar li').removeClass('djdt-active');
213213 // finally close toolbar
214214 $('#djDebugToolbar').hide('fast');
215 handle = $('#djDebugToolbarHandle')
215 handle = $('#djDebugToolbarHandle');
216216 handle.show();
217217 // set handle position
218218 var handleTop = djdt.cookie.get('djdttop');
219219 if (handleTop) {
220 handleTop = Math.min(handleTop, window.innerHeight - handle.outerHeight() - 10)
220 handleTop = Math.min(handleTop, window.innerHeight - handle.outerHeight() - 10);
221221 handle.css({top: handleTop + 'px'});
222222 }
223223 // Unbind keydown
00 {% load i18n %}
11 <table>
2 <col style="width:15%">
3 <col style="width:15%">
24 <thead>
35 <tr>
6 <th>{% trans "Package" %}</th>
47 <th>{% trans "Name" %}</th>
58 <th>{% trans "Version" %}</th>
69 </tr>
710 </thead>
811 <tbody>
9 {% for package, version in versions.items %}
12 {% for package, name, version in versions %}
1013 <tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}">
1114 <td>{{ package }}</td>
15 <td>{{ name }}</td>
1216 <td>{{ version }}</td>
1317 </tr>
1418 {% endfor %}
00 Change log
11 ==========
2
3 1.6
4 ---
5
6 The debug toolbar was adopted by jazzband.
7
8 Removed features
9 ~~~~~~~~~~~~~~~~
10
11 * Support for automatic setup has been removed as it was frequently
12 problematic. Installation now requires explicit setup. The
13 ``DEBUG_TOOLBAR_PATCH_SETTINGS`` setting has also been removed as it is now
14 unused. See the :doc:`installation documentation <installation>` for details.
15
16 Bugfixes
17 ~~~~~~~~
18
19 * The ``DebugToolbarMiddleware`` now also supports Django 1.10's ``MIDDLEWARE``
20 setting.
221
322 1.5
423 ---
5858 # built documents.
5959 #
6060 # The short X.Y version.
61 version = '1.5'
61 version = '1.6'
6262 # The full version, including alpha/beta/rc tags.
63 release = '1.5'
63 release = '1.6'
6464
6565 # The language for content autogenerated by Sphinx. Refer to documentation
6666 # for a list of supported languages.
1010 the default values shown below into you settings module! It's useless and
1111 it'll prevent you from taking advantage of better defaults that may be
1212 introduced in future releases.
13
14 DEBUG_TOOLBAR_PATCH_SETTINGS
15 ----------------------------
16
17 This setting defines whether the toolbar will attempt to automatically adjust
18 your project's settings, as described in the :doc:`installation instructions
19 <installation>`. By default it has the same value as your ``DEBUG`` setting.
2013
2114 DEBUG_TOOLBAR_PANELS
2215 --------------------
00 Contributing
11 ============
2
3 .. image:: https://jazzband.co/static/img/jazzband.svg
4 :target: https://jazzband.co/
5 :alt: Jazzband
6
7 This is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree
8 to abide by the `Contributor Code of Conduct <https://jazzband.co/about/conduct>`_
9 and follow the `guidelines <https://jazzband.co/about/guidelines>`_.
210
311 Bug reports and feature requests
412 --------------------------------
513
614 You can report bugs and request features in the `bug tracker
7 <http://github.com/django-debug-toolbar/django-debug-toolbar/issues>`_.
15 <http://github.com/jazzband/django-debug-toolbar/issues>`_.
816
917 Please search the existing database for duplicates before filing an issue.
1018
1220 ----
1321
1422 The code is available `on GitHub
15 <http://github.com/django-debug-toolbar/django-debug-toolbar>`_.
23 <http://github.com/jazzband/django-debug-toolbar>`_.
1624
1725 Once you've obtained a checkout, you should create a virtualenv_ and install
1826 the libraries required for working on the Debug Toolbar::
8391 -------
8492
8593 Please submit `pull requests
86 <http://github.com/django-debug-toolbar/django-debug-toolbar/pulls>`_!
94 <http://github.com/jazzband/django-debug-toolbar/pulls>`_!
8795
8896 The Debug Toolbar includes a limited but growing test suite. If you fix a bug
8997 or add a feature code, please consider adding proper coverage in the test
1515 To test an upcoming release, you can install the in-development version
1616 instead with the following command::
1717
18 $ pip install -e git+https://github.com/django-debug-toolbar/django-debug-toolbar.git#egg=django-debug-toolbar
18 $ pip install -e git+https://github.com/jazzband/django-debug-toolbar.git#egg=django-debug-toolbar
1919
2020 Prerequisites
2121 -------------
3636 If you're upgrading from a previous version, you should review the
3737 :doc:`change log <changes>` and look for specific upgrade instructions.
3838
39 Automatic setup
40 ---------------
41
42 If you just add the Debug Toolbar to the ``INSTALLED_APPS`` setting as shown
43 above, when the ``DEBUG`` setting is ``True``, the Debug Toolbar will attempt
44 to patch your settings to configure itself automatically.
45
46 .. warning::
47
48 The automatic setup is known to interfere with the start-up sequence of
49 some projects and to prevent them from loading or functioning properly.
50
51 **The explicit setup described below is recommended for all but the most
52 trivial projects. The automatic setup is kept for backwards-compatibility.**
53
54 .. note::
55
56 The automatic setup imports your project's URLconf in order to add the
57 Debug Toolbar's URLs. This is likely to trigger circular imports, for
58 instance when the URLconf imports views that import models, a pattern
59 found in almost every Django project.
60
61 If the development server crashes with a long stack trace after hitting an
62 :exc:`ImportError`, an :exc:`~django.apps.exceptions.AppRegistryNotReady`
63 or an :exc:`~django.core.exceptions.ImproperlyConfigured` exception, use
64 the explicit setup described below.
65
66 When the automatic setup is used, the Debug Toolbar is not compatible with
67 :class:`~django.middleware.gzip.GZipMiddleware`. Please disable that
68 middleware during development or use the explicit setup to allow the
69 toolbar to function properly.
70
71 Explicit setup
72 --------------
73
74 This is the recommended way to configure the Debug Toolbar. First, disable the
75 automatic setup by adding this line in your settings module::
76
77 DEBUG_TOOLBAR_PATCH_SETTINGS = False
78
7939 URLconf
80 ~~~~~~~
40 -------
8141
8242 Add the Debug Toolbar's URLs to your project's URLconf as follows::
8343
8444 from django.conf import settings
85 from django.conf.urls import include, patterns, url
45 from django.conf.urls import include, url
8646
8747 if settings.DEBUG:
8848 import debug_toolbar
9454 doesn't clash with your application's URLs. Note the lack of quotes around
9555 ``debug_toolbar.urls``.
9656
97 .. note::
98
99 The automatic setup appends the Debug Toolbar URLs to the root URLconf.
100
10157 Middleware
102 ~~~~~~~~~~
58 ----------
10359
10460 The Debug Toolbar is mostly implemented in a middleware. Enable it in your
10561 settings module as follows::
62
63 MIDDLEWARE = [
64 # ...
65 'debug_toolbar.middleware.DebugToolbarMiddleware',
66 # ...
67 ]
68
69 Old-style middleware::
10670
10771 MIDDLEWARE_CLASSES = [
10872 # ...
11074 # ...
11175 ]
11276
113 The order of ``MIDDLEWARE_CLASSES`` is important. You should include the Debug
114 Toolbar middleware as early as possible in the list. However, it must come
115 after any other middleware that encodes the response's content, such as
116 :class:`~django.middleware.gzip.GZipMiddleware`.
77 .. warning::
11778
118 .. note::
119
120 The automatic setup inserts the Debug Toolbar middleware at the beginning
121 of ``MIDDLEWARE_CLASSES``, unless it's already included.
79 The order of ``MIDDLEWARE`` and ``MIDDLEWARE_CLASSES`` is important. You
80 should include the Debug Toolbar middleware as early as possible in the
81 list. However, it must come after any other middleware that encodes the
82 response's content, such as
83 :class:`~django.middleware.gzip.GZipMiddleware`.
12284
12385 Internal IPs
124 ~~~~~~~~~~~~
86 ------------
12587
12688 The Debug Toolbar is shown only if your IP is listed in the ``INTERNAL_IPS``
12789 setting. (You can change this logic with the ``SHOW_TOOLBAR_CALLBACK``
12890 option.) For local development, you should add ``'127.0.0.1'`` to
12991 ``INTERNAL_IPS``.
130
131 .. note::
132
133 The automatic setup sets ``INTERNAL_IPS`` to ``'127.0.0.1'`` and
134 ``'::1'``, unless it's already set to a non-empty value.
1010
1111 DEBUG = True
1212
13 INTERNAL_IPS = ['127.0.0.1', '::1']
1314
1415 # Application definition
1516
16 INSTALLED_APPS = (
17 INSTALLED_APPS = [
1718 'django.contrib.admin',
1819 'django.contrib.auth',
1920 'django.contrib.contenttypes',
2122 'django.contrib.messages',
2223 'django.contrib.staticfiles',
2324 'debug_toolbar',
24 )
25 ]
2526
26 MIDDLEWARE_CLASSES = (
27 MIDDLEWARE = [
28 'debug_toolbar.middleware.DebugToolbarMiddleware',
29 'django.middleware.security.SecurityMiddleware',
30 'django.contrib.sessions.middleware.SessionMiddleware',
2731 'django.middleware.common.CommonMiddleware',
28 'django.contrib.sessions.middleware.SessionMiddleware',
32 'django.middleware.csrf.CsrfViewMiddleware',
2933 'django.contrib.auth.middleware.AuthenticationMiddleware',
3034 'django.contrib.messages.middleware.MessageMiddleware',
31 'django.middleware.csrf.CsrfViewMiddleware',
32 )
35 'django.middleware.clickjacking.XFrameOptionsMiddleware',
36 ]
3337
3438 ROOT_URLCONF = 'example.urls'
3539
4246 'DIRS': [os.path.join(BASE_DIR, 'example', 'templates')],
4347 'OPTIONS': {
4448 'debug': True,
49 'context_processors': [
50 'django.template.context_processors.debug',
51 'django.template.context_processors.request',
52 'django.contrib.auth.context_processors.auth',
53 'django.contrib.messages.context_processors.messages',
54 ],
4555 },
4656 },
4757 ]
0 from django.conf import settings
01 from django.conf.urls import include, url
12 from django.contrib import admin
23 from django.views.generic import TemplateView
89 url(r'^prototype/$', TemplateView.as_view(template_name='prototype/index.html')),
910 url(r'^admin/', include(admin.site.urls)),
1011 ]
12
13 if settings.DEBUG:
14 import debug_toolbar
15 urlpatterns += [
16 url(r'^__debug__/', include(debug_toolbar.urls)),
17 ]
33
44 setup(
55 name='django-debug-toolbar',
6 version='1.5',
6 version='1.6',
77 description='A configurable set of panels that display various debug '
88 'information about the current request/response.',
99 long_description=open('README.rst', encoding='utf-8').read(),
1010 author='Rob Hudson',
1111 author_email='rob@cogit8.org',
12 url='https://github.com/django-debug-toolbar/django-debug-toolbar',
12 url='https://github.com/jazzband/django-debug-toolbar',
1313 download_url='https://pypi.python.org/pypi/django-debug-toolbar',
1414 license='BSD',
1515 packages=find_packages(exclude=('tests.*', 'tests', 'example')),
2525 'Framework :: Django',
2626 'Framework :: Django :: 1.8',
2727 'Framework :: Django :: 1.9',
28 'Framework :: Django :: 1.10',
2829 'Intended Audience :: Developers',
2930 'License :: OSI Approved :: BSD License',
3031 'Operating System :: OS Independent',
0 def simple_middleware(get_response):
1 """
2 Used to test Django 1.10 compatibility.
3 """
4 def middleware(request):
5 return get_response(request)
6 return middleware
3030
3131 MIDDLEWARE_CLASSES = [
3232 'debug_toolbar.middleware.DebugToolbarMiddleware',
33 'django.middleware.security.SecurityMiddleware',
3334 'django.contrib.sessions.middleware.SessionMiddleware',
3435 'django.middleware.common.CommonMiddleware',
3536 'django.middleware.csrf.CsrfViewMiddleware',
4445 {
4546 'BACKEND': 'django.template.backends.django.DjangoTemplates',
4647 'APP_DIRS': True,
47 'OPTIONS': {},
48 'OPTIONS': {
49 'context_processors': [
50 'django.template.context_processors.debug',
51 'django.template.context_processors.request',
52 'django.contrib.auth.context_processors.auth',
53 'django.contrib.messages.context_processors.messages',
54 ],
55 },
4856 },
4957 ]
5058
55 import unittest
66 from xml.etree import ElementTree as ET
77
8 import django
89 from django.contrib.staticfiles.testing import StaticLiveServerTestCase
10 from django.core.checks import Error, run_checks
911 from django.test import RequestFactory, TestCase
1012 from django.test.utils import override_settings
1113
189191 WebDriverWait(self.selenium, timeout=10).until(
190192 lambda selenium: self.selenium.find_element_by_css_selector(
191193 '#djDebugWindow code'))
194
195
196 @override_settings(DEBUG=True)
197 class DebugToolbarSystemChecksTestCase(BaseTestCase):
198 @override_settings(
199 MIDDLEWARE=None,
200 MIDDLEWARE_CLASSES=[
201 'django.middleware.gzip.GZipMiddleware',
202 'debug_toolbar.middleware.DebugToolbarMiddleware',
203 ]
204 )
205 def test_check_good_configuration(self):
206 messages = run_checks()
207 self.assertEqual(messages, [])
208
209 @override_settings(MIDDLEWARE=None, MIDDLEWARE_CLASSES=[])
210 def test_check_missing_middleware_error(self):
211 messages = run_checks()
212 self.assertEqual(
213 messages,
214 [
215 Error(
216 "debug_toolbar.middleware.DebugToolbarMiddleware is "
217 "missing from MIDDLEWARE_CLASSES.",
218 hint="Add debug_toolbar.middleware.DebugToolbarMiddleware "
219 "to MIDDLEWARE_CLASSES.",
220 ),
221 ]
222 )
223
224 @override_settings(
225 MIDDLEWARE=None,
226 MIDDLEWARE_CLASSES=[
227 'debug_toolbar.middleware.DebugToolbarMiddleware',
228 'django.middleware.gzip.GZipMiddleware',
229 ]
230 )
231 def test_check_gzip_middleware_error(self):
232 messages = run_checks()
233 self.assertEqual(
234 messages,
235 [
236 Error(
237 "debug_toolbar.middleware.DebugToolbarMiddleware occurs "
238 "before django.middleware.gzip.GZipMiddleware in "
239 "MIDDLEWARE_CLASSES.",
240 hint="Move debug_toolbar.middleware.DebugToolbarMiddleware "
241 "to after django.middleware.gzip.GZipMiddleware in "
242 "MIDDLEWARE_CLASSES.",
243 ),
244 ]
245 )
246
247 @override_settings(
248 MIDDLEWARE=[
249 'debug_toolbar.middleware.DebugToolbarMiddleware',
250 'tests.middleware.simple_middleware',
251 ],
252 MIDDLEWARE_CLASSES=None
253 )
254 def test_middleware_factory_functions_supported(self):
255 messages = run_checks()
256
257 if django.VERSION[:2] < (1, 10):
258 self.assertEqual(messages, [])
259 else:
260 self.assertEqual(messages[0].id, '1_10.W001')
00 [tox]
11 envlist =
2 py{27,33,34}-django18,
3 py{27,34,35}-django{19,110},
2 py{27,33,34}-dj18,
3 py{27,34,35}-dj{19,110},
44 flake8,
5 isort
5 isort,
6 readme
67
78 [testenv]
89 basepython =
1011 py33: python3.3
1112 py34: python3.4
1213 py35: python3.5
13 commands = make test
1414 deps =
15 django18: Django>=1.8,<1.9
16 django19: Django>=1.9,<1.10
17 django110: Django>=1.10a,<1.11
18 selenium
15 dj18: Django>=1.8,<1.9
16 dj19: Django>=1.9,<1.10
17 dj110: Django>=1.10a,<1.11
18 coverage
19 selenium<3.0
1920 sqlparse
2021 setenv =
2122 PYTHONPATH = {toxinidir}
2223 whitelist_externals = make
23 pip_pre=True
24 pip_pre = True
25 usedevelop = true
26 commands = make coverage
2427
2528 [testenv:flake8]
26 basepython =
27 python2.7
29 basepython = python2.7
2830 commands = make flake8
29 deps =
30 flake8
31 deps = flake8
3132
3233 [testenv:isort]
33 basepython =
34 python2.7
34 basepython = python2.7
3535 commands = make isort_check_only
36 deps =
37 isort
36 deps = isort
37
38 [testenv:jshint]
39 basepython = python2.7
40 commands = make jshint
41
42 [testenv:readme]
43 basepython = python2.7
44 commands = python setup.py check -r -s
45 deps = readme_renderer