Imported Upstream version 1.6
Andrew Starr-Bochicchio
7 years ago
0 | 0 | language: python |
1 | 1 | sudo: false |
2 | python: | |
3 | - "2.7" | |
4 | - "3.3" | |
5 | - "3.4" | |
6 | - "3.5" | |
2 | python: 3.5 | |
3 | cache: pip | |
7 | 4 | 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" | |
19 | 17 | install: |
20 | - travis_retry pip install sqlparse | |
21 | - travis_retry pip install --pre $DJANGO | |
22 | - pip install -e . | |
18 | - pip install tox codecov | |
23 | 19 | 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. |
0 | 0 | include LICENSE |
1 | 1 | include README.rst |
2 | include CONTRIBUTING.md | |
2 | 3 | recursive-include debug_toolbar/locale * |
3 | 4 | recursive-include debug_toolbar/static * |
4 | 5 | recursive-include debug_toolbar/templates * |
27 | 27 | django-admin test tests |
28 | 28 | |
29 | 29 | coverage: |
30 | python --version | |
30 | 31 | coverage erase |
31 | 32 | 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 | |
33 | 35 | coverage html |
34 | 36 | |
35 | 37 | translatable_strings: |
1 | 1 | Django Debug Toolbar |
2 | 2 | ==================== |
3 | 3 | |
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 | |
7 | 19 | |
8 | 20 | The Django Debug Toolbar is a configurable set of panels that display various |
9 | 21 | debug information about the current request/response and when clicked, display |
11 | 23 | |
12 | 24 | Here's a screenshot of the toolbar in action: |
13 | 25 | |
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 | |
15 | 27 | :width: 908 |
16 | 28 | :height: 557 |
17 | 29 | |
18 | 30 | In addition to the built-in panels, a number of third-party panels are |
19 | 31 | contributed by the community. |
20 | 32 | |
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. | |
23 | 34 | |
24 | 35 | Documentation, including installation and configuration instructions, is |
25 | 36 | available at https://django-debug-toolbar.readthedocs.io/. |
30 | 41 | The Django Debug Toolbar was originally created by Rob Hudson <rob@cogit8.org> |
31 | 42 | in August 2008 and was further developed by many contributors_. |
32 | 43 | |
33 | .. _contributors: https://github.com/django-debug-toolbar/django-debug-toolbar/graphs/contributors | |
44 | .. _contributors: https://github.com/jazzband/django-debug-toolbar/graphs/contributors |
0 | 0 | from __future__ import absolute_import, unicode_literals |
1 | 1 | |
2 | import inspect | |
3 | ||
2 | 4 | 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 | |
3 | 9 | from django.utils.translation import ugettext_lazy as _ |
4 | 10 | |
5 | from debug_toolbar import settings as dt_settings | |
11 | from debug_toolbar.middleware import DebugToolbarMiddleware | |
6 | 12 | |
7 | 13 | |
8 | 14 | class DebugToolbarConfig(AppConfig): |
9 | 15 | name = 'debug_toolbar' |
10 | 16 | verbose_name = _("Debug Toolbar") |
11 | 17 | |
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 | ) |
Binary diff not shown
0 | 0 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER |
1 | 1 | # This file is distributed under the same license as the PACKAGE package. |
2 | # | |
3 | # | |
2 | # | |
3 | # | |
4 | 4 | # Translators: |
5 | 5 | # Ilya Baryshev <baryshev@gmail.com>, 2013 |
6 | 6 | # Mikhail Korobov, 2009 |
9 | 9 | msgstr "" |
10 | 10 | "Project-Id-Version: Django Debug Toolbar\n" |
11 | 11 | "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" | |
16 | 18 | "MIME-Version: 1.0\n" |
17 | 19 | "Content-Type: text/plain; charset=UTF-8\n" |
18 | 20 | "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" | |
21 | 24 | |
22 | 25 | #: apps.py:11 |
23 | 26 | 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 | |
33 | 30 | msgid "Cache" |
34 | msgstr "Кэш" | |
35 | ||
36 | #: panels/cache.py:196 | |
31 | msgstr "Кеш" | |
32 | ||
33 | #: panels/cache.py:209 | |
37 | 34 | #, python-format |
38 | 35 | msgid "%(cache_calls)d call in %(time).2fms" |
39 | 36 | 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 | |
45 | 42 | #, python-format |
46 | 43 | msgid "Cache calls from %(count)d backend" |
47 | 44 | 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 | |
53 | 50 | msgid "Headers" |
54 | 51 | msgstr "Заголовки" |
55 | 52 | |
56 | #: panels/logging.py:64 | |
53 | #: panels/logging.py:66 | |
57 | 54 | msgid "Logging" |
58 | 55 | msgstr "Логи" |
59 | 56 | |
60 | #: panels/logging.py:70 | |
57 | #: panels/logging.py:72 | |
61 | 58 | #, python-format |
62 | 59 | msgid "%(count)s message" |
63 | 60 | msgid_plural "%(count)s messages" |
65 | 62 | msgstr[1] "%(count)s сообщений" |
66 | 63 | msgstr[2] "%(count)s сообщений" |
67 | 64 | |
68 | #: panels/logging.py:73 | |
65 | #: panels/logging.py:75 | |
69 | 66 | msgid "Log messages" |
70 | 67 | msgstr "Сообщения в логе" |
71 | 68 | |
72 | #: panels/profiling.py:127 | |
69 | #: panels/profiling.py:144 | |
73 | 70 | msgid "Profiling" |
74 | 71 | msgstr "Профилирование" |
75 | 72 | |
76 | #: panels/redirects.py:17 | |
73 | #: panels/redirects.py:16 | |
77 | 74 | msgid "Intercept redirects" |
78 | msgstr "Перехват редиректов" | |
75 | msgstr "Перехватывать перенаправления" | |
79 | 76 | |
80 | 77 | #: panels/request.py:18 |
81 | 78 | msgid "Request" |
83 | 80 | |
84 | 81 | #: panels/request.py:35 |
85 | 82 | msgid "<no view>" |
86 | msgstr "<нет view>" | |
83 | msgstr "<нет представления>" | |
87 | 84 | |
88 | 85 | #: panels/request.py:47 |
89 | 86 | msgid "<unavailable>" |
90 | 87 | msgstr "<недоступно>" |
91 | 88 | |
92 | #: panels/settings.py:20 | |
89 | #: panels/settings.py:18 | |
93 | 90 | msgid "Settings" |
94 | 91 | msgstr "Настройки" |
95 | 92 | |
96 | #: panels/settings.py:23 | |
93 | #: panels/settings.py:21 | |
97 | 94 | #, python-format |
98 | 95 | msgid "Settings from <code>%s</code>" |
99 | 96 | msgstr "Настройки из <code>%s</code>" |
100 | 97 | |
101 | #: panels/signals.py:45 | |
98 | #: panels/signals.py:44 | |
102 | 99 | #, python-format |
103 | 100 | msgid "%(num_receivers)d receiver of 1 signal" |
104 | 101 | msgid_plural "%(num_receivers)d receivers of 1 signal" |
106 | 103 | msgstr[1] "%(num_receivers)d получателя 1 сигнала" |
107 | 104 | msgstr[2] "%(num_receivers)d получателей 1 сигнала" |
108 | 105 | |
109 | #: panels/signals.py:48 | |
106 | #: panels/signals.py:47 | |
110 | 107 | #, python-format |
111 | 108 | msgid "%(num_receivers)d receiver of %(num_signals)d signals" |
112 | 109 | msgid_plural "%(num_receivers)d receivers of %(num_signals)d signals" |
114 | 111 | msgstr[1] "%(num_receivers)d получателя %(num_signals)d сигнала(ов)" |
115 | 112 | msgstr[2] "%(num_receivers)d получателей %(num_signals)d сигнала(ов)" |
116 | 113 | |
117 | #: panels/signals.py:53 | |
114 | #: panels/signals.py:52 | |
118 | 115 | msgid "Signals" |
119 | 116 | msgstr "Сигналы" |
120 | 117 | |
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 | |
122 | 163 | #, python-format |
123 | 164 | 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 | |
127 | 168 | msgid "Static files" |
128 | msgstr "" | |
129 | ||
130 | #: panels/staticfiles.py:112 | |
169 | msgstr "Статика" | |
170 | ||
171 | #: panels/staticfiles.py:110 | |
131 | 172 | #, python-format |
132 | 173 | msgid "%(num_used)s file used" |
133 | 174 | 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 | |
139 | 193 | #, python-format |
140 | 194 | 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 | |
144 | 198 | #, python-format |
145 | 199 | 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 | |
149 | 203 | #: templates/debug_toolbar/panels/sql_explain.html:11 |
150 | 204 | #: templates/debug_toolbar/panels/sql_profile.html:12 |
151 | 205 | #: templates/debug_toolbar/panels/sql_select.html:11 |
152 | 206 | msgid "Time" |
153 | 207 | msgstr "Время" |
154 | 208 | |
155 | #: panels/timer.py:42 | |
209 | #: panels/timer.py:45 | |
156 | 210 | msgid "User CPU time" |
157 | msgstr "User CPU time" | |
158 | ||
159 | #: panels/timer.py:42 | |
211 | msgstr "Пользовательское время ядра" | |
212 | ||
213 | #: panels/timer.py:45 | |
160 | 214 | #, python-format |
161 | 215 | msgid "%(utime)0.3f msec" |
162 | 216 | msgstr "%(utime)0.3f мс" |
163 | 217 | |
164 | #: panels/timer.py:43 | |
218 | #: panels/timer.py:46 | |
165 | 219 | msgid "System CPU time" |
166 | msgstr "System CPU time" | |
167 | ||
168 | #: panels/timer.py:43 | |
220 | msgstr "Системное время ядра" | |
221 | ||
222 | #: panels/timer.py:46 | |
169 | 223 | #, python-format |
170 | 224 | msgid "%(stime)0.3f msec" |
171 | 225 | msgstr "%(stime)0.3f мс" |
172 | 226 | |
173 | #: panels/timer.py:44 | |
227 | #: panels/timer.py:47 | |
174 | 228 | msgid "Total CPU time" |
175 | msgstr "Total CPU time" | |
176 | ||
177 | #: panels/timer.py:44 | |
229 | msgstr "Общее время ядра" | |
230 | ||
231 | #: panels/timer.py:47 | |
178 | 232 | #, python-format |
179 | 233 | msgid "%(total)0.3f msec" |
180 | 234 | msgstr "%(total)0.3f мс" |
181 | 235 | |
182 | #: panels/timer.py:45 | |
236 | #: panels/timer.py:48 | |
183 | 237 | msgid "Elapsed time" |
184 | 238 | msgstr "Затраченное время" |
185 | 239 | |
186 | #: panels/timer.py:45 | |
240 | #: panels/timer.py:48 | |
187 | 241 | #, python-format |
188 | 242 | msgid "%(total_time)0.3f msec" |
189 | 243 | msgstr "%(total_time)0.3f мс" |
190 | 244 | |
191 | #: panels/timer.py:46 | |
245 | #: panels/timer.py:49 | |
192 | 246 | msgid "Context switches" |
193 | msgstr "Переключений контекста" | |
194 | ||
195 | #: panels/timer.py:46 | |
247 | msgstr "Переключения контекста" | |
248 | ||
249 | #: panels/timer.py:49 | |
196 | 250 | #, python-format |
197 | 251 | msgid "%(vcsw)d voluntary, %(ivcsw)d involuntary" |
198 | 252 | msgstr "%(vcsw)d намеренных, %(ivcsw)d вынужденных" |
199 | 253 | |
200 | #: panels/versions.py:25 | |
254 | #: panels/versions.py:20 | |
201 | 255 | msgid "Versions" |
202 | 256 | 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)" | |
256 | 257 | |
257 | 258 | #: templates/debug_toolbar/base.html:19 |
258 | 259 | msgid "Hide toolbar" |
274 | 275 | msgid "Show toolbar" |
275 | 276 | msgstr "Показать панель" |
276 | 277 | |
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 | ||
292 | 278 | #: templates/debug_toolbar/panels/cache.html:2 |
293 | 279 | msgid "Summary" |
294 | 280 | msgstr "Сводка" |
303 | 289 | |
304 | 290 | #: templates/debug_toolbar/panels/cache.html:8 |
305 | 291 | msgid "Cache hits" |
306 | msgstr "Cache хитов" | |
292 | msgstr "Попадания" | |
307 | 293 | |
308 | 294 | #: templates/debug_toolbar/panels/cache.html:9 |
309 | 295 | msgid "Cache misses" |
310 | msgstr "Промахи кэша" | |
296 | msgstr "Промахи" | |
311 | 297 | |
312 | 298 | #: templates/debug_toolbar/panels/cache.html:21 |
313 | 299 | msgid "Commands" |
318 | 304 | msgstr "Вызовы" |
319 | 305 | |
320 | 306 | #: templates/debug_toolbar/panels/cache.html:43 |
321 | #: templates/debug_toolbar/panels/sql.html:20 | |
307 | #: templates/debug_toolbar/panels/sql.html:23 | |
322 | 308 | msgid "Time (ms)" |
323 | 309 | msgstr "Время (мс)" |
324 | 310 | |
374 | 360 | msgid "" |
375 | 361 | "Since the WSGI environ inherits the environment of the server, only a " |
376 | 362 | "significant subset is shown below." |
377 | msgstr "Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те из переменных, которые важны для нужд отладки." | |
363 | msgstr "" | |
364 | "Так как WSGI-окружение наследует окружение сервера, ниже отображены лишь те " | |
365 | "из переменных, которые важны для нужд отладки." | |
378 | 366 | |
379 | 367 | #: templates/debug_toolbar/panels/logging.html:6 |
380 | 368 | msgid "Level" |
389 | 377 | msgstr "Сообщение" |
390 | 378 | |
391 | 379 | #: templates/debug_toolbar/panels/logging.html:10 |
392 | #: templates/debug_toolbar/panels/staticfiles.html:45 | |
380 | #: templates/debug_toolbar/panels/staticfiles.html:44 | |
393 | 381 | msgid "Location" |
394 | 382 | msgstr "Место" |
395 | 383 | |
420 | 408 | |
421 | 409 | #: templates/debug_toolbar/panels/request.html:3 |
422 | 410 | msgid "View information" |
423 | msgstr "View" | |
411 | msgstr "Информация о представлении" | |
424 | 412 | |
425 | 413 | #: templates/debug_toolbar/panels/request.html:7 |
426 | 414 | msgid "View function" |
427 | msgstr "View функция" | |
415 | msgstr "Функция представления" | |
428 | 416 | |
429 | 417 | #: templates/debug_toolbar/panels/request.html:10 |
430 | 418 | msgid "URL name" |
431 | msgstr "URL Name" | |
419 | msgstr "Имя URL" | |
432 | 420 | |
433 | 421 | #: templates/debug_toolbar/panels/request.html:24 |
434 | 422 | msgid "Cookies" |
435 | msgstr "Cookies" | |
423 | msgstr "Куки" | |
436 | 424 | |
437 | 425 | #: templates/debug_toolbar/panels/request.html:32 |
438 | 426 | #: templates/debug_toolbar/panels/request.html:58 |
443 | 431 | |
444 | 432 | #: templates/debug_toolbar/panels/request.html:46 |
445 | 433 | msgid "No cookies" |
446 | msgstr "Нет cookies" | |
434 | msgstr "Нет куков" | |
447 | 435 | |
448 | 436 | #: templates/debug_toolbar/panels/request.html:50 |
449 | 437 | msgid "Session data" |
479 | 467 | |
480 | 468 | #: templates/debug_toolbar/panels/signals.html:6 |
481 | 469 | msgid "Providing" |
482 | msgstr "" | |
470 | msgstr "Аргументы" | |
483 | 471 | |
484 | 472 | #: templates/debug_toolbar/panels/signals.html:7 |
485 | 473 | msgid "Receivers" |
493 | 481 | msgstr[1] "%(num)s запроса" |
494 | 482 | msgstr[2] "%(num)s запросов" |
495 | 483 | |
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 | |
497 | 490 | msgid "Query" |
498 | 491 | msgstr "Запрос" |
499 | 492 | |
500 | #: templates/debug_toolbar/panels/sql.html:19 | |
493 | #: templates/debug_toolbar/panels/sql.html:22 | |
501 | 494 | #: templates/debug_toolbar/panels/timer.html:36 |
502 | 495 | msgid "Timeline" |
503 | 496 | msgstr "Временная диаграмма" |
504 | 497 | |
505 | #: templates/debug_toolbar/panels/sql.html:21 | |
498 | #: templates/debug_toolbar/panels/sql.html:24 | |
506 | 499 | msgid "Action" |
507 | 500 | msgstr "Действие" |
508 | 501 | |
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 | |
510 | 508 | msgid "Connection:" |
511 | 509 | msgstr "Соединение:" |
512 | 510 | |
513 | #: templates/debug_toolbar/panels/sql.html:66 | |
511 | #: templates/debug_toolbar/panels/sql.html:75 | |
514 | 512 | msgid "Isolation level:" |
515 | 513 | msgstr "Уровень изоляции:" |
516 | 514 | |
517 | #: templates/debug_toolbar/panels/sql.html:69 | |
515 | #: templates/debug_toolbar/panels/sql.html:78 | |
518 | 516 | msgid "Transaction status:" |
519 | 517 | msgstr "Статус транзакции:" |
520 | 518 | |
521 | #: templates/debug_toolbar/panels/sql.html:83 | |
519 | #: templates/debug_toolbar/panels/sql.html:92 | |
522 | 520 | msgid "(unknown)" |
523 | 521 | msgstr "(неизвестно)" |
524 | 522 | |
525 | #: templates/debug_toolbar/panels/sql.html:92 | |
523 | #: templates/debug_toolbar/panels/sql.html:101 | |
526 | 524 | 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-запроса." | |
535 | 527 | |
536 | 528 | #: templates/debug_toolbar/panels/sql_explain.html:4 |
537 | 529 | msgid "SQL explained" |
565 | 557 | msgid "Empty set" |
566 | 558 | msgstr "Ничего, ноль строк" |
567 | 559 | |
568 | #: templates/debug_toolbar/panels/staticfiles.html:4 | |
560 | #: templates/debug_toolbar/panels/staticfiles.html:3 | |
569 | 561 | msgid "Static file path" |
570 | 562 | 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 | |
576 | 568 | #, python-format |
577 | 569 | 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 | |
583 | 575 | #: templates/debug_toolbar/panels/templates.html:10 |
584 | 576 | #: templates/debug_toolbar/panels/templates.html:28 |
585 | 577 | #: templates/debug_toolbar/panels/templates.html:43 |
586 | 578 | msgid "None" |
587 | 579 | msgstr "Нет" |
588 | 580 | |
589 | #: templates/debug_toolbar/panels/staticfiles.html:15 | |
581 | #: templates/debug_toolbar/panels/staticfiles.html:14 | |
590 | 582 | msgid "Static file app" |
591 | 583 | 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 | |
597 | 589 | msgid "Static file" |
598 | 590 | 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 | |
604 | 596 | #, python-format |
605 | 597 | msgid "%(payload_count)s file" |
606 | 598 | 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 | |
612 | 604 | msgid "Path" |
613 | msgstr "" | |
605 | msgstr "Путь" | |
614 | 606 | |
615 | 607 | #: templates/debug_toolbar/panels/template_source.html:4 |
616 | 608 | msgid "Template source:" |
662 | 654 | msgid "Milliseconds since navigation start (+length)" |
663 | 655 | msgstr "С начала навигации в мс (+продолжительность)" |
664 | 656 | |
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 | |
666 | 662 | msgid "Name" |
667 | 663 | msgstr "Название" |
668 | 664 | |
669 | #: templates/debug_toolbar/panels/versions.html:6 | |
665 | #: templates/debug_toolbar/panels/versions.html:9 | |
670 | 666 | msgid "Version" |
671 | 667 | 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 "Назад" |
9 | 9 | from django.conf import settings |
10 | 10 | from django.utils import six |
11 | 11 | from django.utils.encoding import force_text |
12 | from django.utils.functional import cached_property | |
12 | 13 | from django.utils.module_loading import import_string |
13 | 14 | |
14 | 15 | from debug_toolbar import settings as dt_settings |
15 | 16 | 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 | ||
16 | 24 | |
17 | 25 | _HTML_TYPES = ('text/html', 'application/xhtml+xml') |
18 | 26 | |
30 | 38 | return bool(settings.DEBUG) |
31 | 39 | |
32 | 40 | |
33 | class DebugToolbarMiddleware(object): | |
41 | class DebugToolbarMiddleware(MiddlewareMixin): | |
34 | 42 | """ |
35 | 43 | Middleware to set up Debug Toolbar on incoming request and render toolbar |
36 | 44 | on outgoing response. |
37 | 45 | """ |
38 | 46 | debug_toolbars = {} |
39 | 47 | |
40 | def __init__(self): | |
48 | @cached_property | |
49 | def show_toolbar(self): | |
41 | 50 | # If SHOW_TOOLBAR_CALLBACK is a string, which is the recommended |
42 | 51 | # setup, resolve it to the corresponding callable. |
43 | 52 | func_or_path = dt_settings.get_config()['SHOW_TOOLBAR_CALLBACK'] |
44 | 53 | if isinstance(func_or_path, six.string_types): |
45 | self.show_toolbar = import_string(func_or_path) | |
54 | return import_string(func_or_path) | |
46 | 55 | else: |
47 | self.show_toolbar = func_or_path | |
56 | return func_or_path | |
48 | 57 | |
49 | 58 | def process_request(self, request): |
50 | 59 | # Decide whether the toolbar is active for this request. |
0 | 0 | from __future__ import absolute_import, unicode_literals |
1 | 1 | |
2 | 2 | import sys |
3 | from collections import OrderedDict | |
4 | 3 | |
5 | 4 | import django |
6 | 5 | from django.apps import apps |
23 | 22 | |
24 | 23 | def generate_stats(self, request, response): |
25 | 24 | 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)), | |
28 | 27 | ] |
29 | 28 | versions += list(self.gen_app_versions()) |
30 | 29 | self.record_stats({ |
31 | 'versions': OrderedDict(sorted(versions, key=lambda v: v[0])), | |
30 | 'versions': sorted(versions, key=lambda v: v[0]), | |
32 | 31 | 'paths': sys.path, |
33 | 32 | }) |
34 | 33 | |
38 | 37 | app = app_config.module |
39 | 38 | version = self.get_app_version(app) |
40 | 39 | if version: |
41 | yield name, version | |
40 | yield app.__name__, name, version | |
42 | 41 | |
43 | 42 | def get_app_version(self, app): |
44 | 43 | if hasattr(app, 'get_version'): |
0 | 0 | from __future__ import absolute_import, unicode_literals |
1 | 1 | |
2 | 2 | import warnings |
3 | from importlib import import_module | |
4 | 3 | |
5 | 4 | from django.conf import settings |
6 | 5 | from django.utils import six |
7 | 6 | from django.utils.lru_cache import lru_cache |
8 | from django.utils.module_loading import import_string | |
9 | 7 | |
10 | 8 | # Always import this module as follows: |
11 | 9 | # from debug_toolbar import settings [as dt_settings] |
156 | 154 | "setting." % (old_panel, new_panel), DeprecationWarning) |
157 | 155 | PANELS[index] = new_panel |
158 | 156 | 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() |
212 | 212 | $('#djDebugToolbar li').removeClass('djdt-active'); |
213 | 213 | // finally close toolbar |
214 | 214 | $('#djDebugToolbar').hide('fast'); |
215 | handle = $('#djDebugToolbarHandle') | |
215 | handle = $('#djDebugToolbarHandle'); | |
216 | 216 | handle.show(); |
217 | 217 | // set handle position |
218 | 218 | var handleTop = djdt.cookie.get('djdttop'); |
219 | 219 | if (handleTop) { |
220 | handleTop = Math.min(handleTop, window.innerHeight - handle.outerHeight() - 10) | |
220 | handleTop = Math.min(handleTop, window.innerHeight - handle.outerHeight() - 10); | |
221 | 221 | handle.css({top: handleTop + 'px'}); |
222 | 222 | } |
223 | 223 | // Unbind keydown |
0 | 0 | {% load i18n %} |
1 | 1 | <table> |
2 | <col style="width:15%"> | |
3 | <col style="width:15%"> | |
2 | 4 | <thead> |
3 | 5 | <tr> |
6 | <th>{% trans "Package" %}</th> | |
4 | 7 | <th>{% trans "Name" %}</th> |
5 | 8 | <th>{% trans "Version" %}</th> |
6 | 9 | </tr> |
7 | 10 | </thead> |
8 | 11 | <tbody> |
9 | {% for package, version in versions.items %} | |
12 | {% for package, name, version in versions %} | |
10 | 13 | <tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}"> |
11 | 14 | <td>{{ package }}</td> |
15 | <td>{{ name }}</td> | |
12 | 16 | <td>{{ version }}</td> |
13 | 17 | </tr> |
14 | 18 | {% endfor %} |
0 | 0 | Change log |
1 | 1 | ========== |
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. | |
2 | 21 | |
3 | 22 | 1.5 |
4 | 23 | --- |
58 | 58 | # built documents. |
59 | 59 | # |
60 | 60 | # The short X.Y version. |
61 | version = '1.5' | |
61 | version = '1.6' | |
62 | 62 | # The full version, including alpha/beta/rc tags. |
63 | release = '1.5' | |
63 | release = '1.6' | |
64 | 64 | |
65 | 65 | # The language for content autogenerated by Sphinx. Refer to documentation |
66 | 66 | # for a list of supported languages. |
10 | 10 | the default values shown below into you settings module! It's useless and |
11 | 11 | it'll prevent you from taking advantage of better defaults that may be |
12 | 12 | 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. | |
20 | 13 | |
21 | 14 | DEBUG_TOOLBAR_PANELS |
22 | 15 | -------------------- |
0 | 0 | Contributing |
1 | 1 | ============ |
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>`_. | |
2 | 10 | |
3 | 11 | Bug reports and feature requests |
4 | 12 | -------------------------------- |
5 | 13 | |
6 | 14 | 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>`_. | |
8 | 16 | |
9 | 17 | Please search the existing database for duplicates before filing an issue. |
10 | 18 | |
12 | 20 | ---- |
13 | 21 | |
14 | 22 | The code is available `on GitHub |
15 | <http://github.com/django-debug-toolbar/django-debug-toolbar>`_. | |
23 | <http://github.com/jazzband/django-debug-toolbar>`_. | |
16 | 24 | |
17 | 25 | Once you've obtained a checkout, you should create a virtualenv_ and install |
18 | 26 | the libraries required for working on the Debug Toolbar:: |
83 | 91 | ------- |
84 | 92 | |
85 | 93 | Please submit `pull requests |
86 | <http://github.com/django-debug-toolbar/django-debug-toolbar/pulls>`_! | |
94 | <http://github.com/jazzband/django-debug-toolbar/pulls>`_! | |
87 | 95 | |
88 | 96 | The Debug Toolbar includes a limited but growing test suite. If you fix a bug |
89 | 97 | or add a feature code, please consider adding proper coverage in the test |
15 | 15 | To test an upcoming release, you can install the in-development version |
16 | 16 | instead with the following command:: |
17 | 17 | |
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 | |
19 | 19 | |
20 | 20 | Prerequisites |
21 | 21 | ------------- |
36 | 36 | If you're upgrading from a previous version, you should review the |
37 | 37 | :doc:`change log <changes>` and look for specific upgrade instructions. |
38 | 38 | |
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 | ||
79 | 39 | URLconf |
80 | ~~~~~~~ | |
40 | ------- | |
81 | 41 | |
82 | 42 | Add the Debug Toolbar's URLs to your project's URLconf as follows:: |
83 | 43 | |
84 | 44 | from django.conf import settings |
85 | from django.conf.urls import include, patterns, url | |
45 | from django.conf.urls import include, url | |
86 | 46 | |
87 | 47 | if settings.DEBUG: |
88 | 48 | import debug_toolbar |
94 | 54 | doesn't clash with your application's URLs. Note the lack of quotes around |
95 | 55 | ``debug_toolbar.urls``. |
96 | 56 | |
97 | .. note:: | |
98 | ||
99 | The automatic setup appends the Debug Toolbar URLs to the root URLconf. | |
100 | ||
101 | 57 | Middleware |
102 | ~~~~~~~~~~ | |
58 | ---------- | |
103 | 59 | |
104 | 60 | The Debug Toolbar is mostly implemented in a middleware. Enable it in your |
105 | 61 | settings module as follows:: |
62 | ||
63 | MIDDLEWARE = [ | |
64 | # ... | |
65 | 'debug_toolbar.middleware.DebugToolbarMiddleware', | |
66 | # ... | |
67 | ] | |
68 | ||
69 | Old-style middleware:: | |
106 | 70 | |
107 | 71 | MIDDLEWARE_CLASSES = [ |
108 | 72 | # ... |
110 | 74 | # ... |
111 | 75 | ] |
112 | 76 | |
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:: | |
117 | 78 | |
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`. | |
122 | 84 | |
123 | 85 | Internal IPs |
124 | ~~~~~~~~~~~~ | |
86 | ------------ | |
125 | 87 | |
126 | 88 | The Debug Toolbar is shown only if your IP is listed in the ``INTERNAL_IPS`` |
127 | 89 | setting. (You can change this logic with the ``SHOW_TOOLBAR_CALLBACK`` |
128 | 90 | option.) For local development, you should add ``'127.0.0.1'`` to |
129 | 91 | ``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. |
10 | 10 | |
11 | 11 | DEBUG = True |
12 | 12 | |
13 | INTERNAL_IPS = ['127.0.0.1', '::1'] | |
13 | 14 | |
14 | 15 | # Application definition |
15 | 16 | |
16 | INSTALLED_APPS = ( | |
17 | INSTALLED_APPS = [ | |
17 | 18 | 'django.contrib.admin', |
18 | 19 | 'django.contrib.auth', |
19 | 20 | 'django.contrib.contenttypes', |
21 | 22 | 'django.contrib.messages', |
22 | 23 | 'django.contrib.staticfiles', |
23 | 24 | 'debug_toolbar', |
24 | ) | |
25 | ] | |
25 | 26 | |
26 | MIDDLEWARE_CLASSES = ( | |
27 | MIDDLEWARE = [ | |
28 | 'debug_toolbar.middleware.DebugToolbarMiddleware', | |
29 | 'django.middleware.security.SecurityMiddleware', | |
30 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
27 | 31 | 'django.middleware.common.CommonMiddleware', |
28 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
32 | 'django.middleware.csrf.CsrfViewMiddleware', | |
29 | 33 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
30 | 34 | 'django.contrib.messages.middleware.MessageMiddleware', |
31 | 'django.middleware.csrf.CsrfViewMiddleware', | |
32 | ) | |
35 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
36 | ] | |
33 | 37 | |
34 | 38 | ROOT_URLCONF = 'example.urls' |
35 | 39 | |
42 | 46 | 'DIRS': [os.path.join(BASE_DIR, 'example', 'templates')], |
43 | 47 | 'OPTIONS': { |
44 | 48 | '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 | ], | |
45 | 55 | }, |
46 | 56 | }, |
47 | 57 | ] |
0 | from django.conf import settings | |
0 | 1 | from django.conf.urls import include, url |
1 | 2 | from django.contrib import admin |
2 | 3 | from django.views.generic import TemplateView |
8 | 9 | url(r'^prototype/$', TemplateView.as_view(template_name='prototype/index.html')), |
9 | 10 | url(r'^admin/', include(admin.site.urls)), |
10 | 11 | ] |
12 | ||
13 | if settings.DEBUG: | |
14 | import debug_toolbar | |
15 | urlpatterns += [ | |
16 | url(r'^__debug__/', include(debug_toolbar.urls)), | |
17 | ] |
3 | 3 | |
4 | 4 | setup( |
5 | 5 | name='django-debug-toolbar', |
6 | version='1.5', | |
6 | version='1.6', | |
7 | 7 | description='A configurable set of panels that display various debug ' |
8 | 8 | 'information about the current request/response.', |
9 | 9 | long_description=open('README.rst', encoding='utf-8').read(), |
10 | 10 | author='Rob Hudson', |
11 | 11 | 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', | |
13 | 13 | download_url='https://pypi.python.org/pypi/django-debug-toolbar', |
14 | 14 | license='BSD', |
15 | 15 | packages=find_packages(exclude=('tests.*', 'tests', 'example')), |
25 | 25 | 'Framework :: Django', |
26 | 26 | 'Framework :: Django :: 1.8', |
27 | 27 | 'Framework :: Django :: 1.9', |
28 | 'Framework :: Django :: 1.10', | |
28 | 29 | 'Intended Audience :: Developers', |
29 | 30 | 'License :: OSI Approved :: BSD License', |
30 | 31 | '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 |
30 | 30 | |
31 | 31 | MIDDLEWARE_CLASSES = [ |
32 | 32 | 'debug_toolbar.middleware.DebugToolbarMiddleware', |
33 | 'django.middleware.security.SecurityMiddleware', | |
33 | 34 | 'django.contrib.sessions.middleware.SessionMiddleware', |
34 | 35 | 'django.middleware.common.CommonMiddleware', |
35 | 36 | 'django.middleware.csrf.CsrfViewMiddleware', |
44 | 45 | { |
45 | 46 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
46 | 47 | '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 | }, | |
48 | 56 | }, |
49 | 57 | ] |
50 | 58 |
5 | 5 | import unittest |
6 | 6 | from xml.etree import ElementTree as ET |
7 | 7 | |
8 | import django | |
8 | 9 | from django.contrib.staticfiles.testing import StaticLiveServerTestCase |
10 | from django.core.checks import Error, run_checks | |
9 | 11 | from django.test import RequestFactory, TestCase |
10 | 12 | from django.test.utils import override_settings |
11 | 13 | |
189 | 191 | WebDriverWait(self.selenium, timeout=10).until( |
190 | 192 | lambda selenium: self.selenium.find_element_by_css_selector( |
191 | 193 | '#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') |
0 | 0 | [tox] |
1 | 1 | 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}, | |
4 | 4 | flake8, |
5 | isort | |
5 | isort, | |
6 | readme | |
6 | 7 | |
7 | 8 | [testenv] |
8 | 9 | basepython = |
10 | 11 | py33: python3.3 |
11 | 12 | py34: python3.4 |
12 | 13 | py35: python3.5 |
13 | commands = make test | |
14 | 14 | 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 | |
19 | 20 | sqlparse |
20 | 21 | setenv = |
21 | 22 | PYTHONPATH = {toxinidir} |
22 | 23 | whitelist_externals = make |
23 | pip_pre=True | |
24 | pip_pre = True | |
25 | usedevelop = true | |
26 | commands = make coverage | |
24 | 27 | |
25 | 28 | [testenv:flake8] |
26 | basepython = | |
27 | python2.7 | |
29 | basepython = python2.7 | |
28 | 30 | commands = make flake8 |
29 | deps = | |
30 | flake8 | |
31 | deps = flake8 | |
31 | 32 | |
32 | 33 | [testenv:isort] |
33 | basepython = | |
34 | python2.7 | |
34 | basepython = python2.7 | |
35 | 35 | 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 |