File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ Toolbar options
72
72
The toolbar searches for this string in the HTML and inserts itself just
73
73
before.
74
74
75
+ .. _IS_RUNNING_TESTS :
76
+
75
77
* ``IS_RUNNING_TESTS ``
76
78
77
79
Default: ``"test" in sys.argv ``
Original file line number Diff line number Diff line change @@ -159,15 +159,22 @@ option.
159
159
7. Disable the toolbar when running tests (optional)
160
160
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
161
161
162
- If you're running tests in your project you shouldn't activate the toolbar. You can do this by adding another setting:
162
+ If you're running tests in your project you shouldn't activate the toolbar. You
163
+ can do this by adding another setting:
163
164
164
165
.. code-block :: python
165
166
166
167
TESTING = " argv" in sys.argv
167
168
168
169
if not TESTING :
169
- INSTALLED_APPS = [* INSTALLED_APPS , " debug_toolbar" ]
170
- MIDDLEWARE = [" debug_toolbar.middleware.DebugToolbarMiddleware" , * MIDDLEWARE ]
170
+ INSTALLED_APPS = [
171
+ * INSTALLED_APPS ,
172
+ " debug_toolbar" ,
173
+ ]
174
+ MIDDLEWARE = [
175
+ " debug_toolbar.middleware.DebugToolbarMiddleware" ,
176
+ * MIDDLEWARE ,
177
+ ]
171
178
172
179
You should also modify your URLconf file:
173
180
@@ -179,6 +186,8 @@ You should also modify your URLconf file:
179
186
path(" __debug__/" , include(" debug_toolbar.urls" )),
180
187
]
181
188
189
+ Alternatively, you can check out the :ref: `IS_RUNNING_TESTS <IS_RUNNING_TESTS >`
190
+ option.
182
191
183
192
Troubleshooting
184
193
---------------
You can’t perform that action at this time.
0 commit comments