@@ -18,8 +18,8 @@ instead with the following command::
18
18
19
19
$ pip install -e git+https://github.com/django-debug-toolbar/django-debug-toolbar.git#egg=django-debug-toolbar
20
20
21
- Quick setup
22
- -----------
21
+ Prerequisites
22
+ -------------
23
23
24
24
Make sure that ``'django.contrib.staticfiles' `` is `set up properly
25
25
<https://docs.djangoproject.com/en/stable/howto/static-files/> `_ and add
@@ -34,25 +34,35 @@ Make sure that ``'django.contrib.staticfiles'`` is `set up properly
34
34
35
35
STATIC_URL = '/static/'
36
36
37
- For a simple Django project, that's all you need!
38
-
39
- The Debug Toolbar will automatically adjust a few settings when you start the
40
- development server, provided the ``DEBUG `` setting is ``True ``.
41
-
42
37
If you're upgrading from a previous version, you should review the
43
38
:doc: `change log <changes >` and look for specific upgrade instructions.
44
39
45
- If the automatic setup doesn't work for your project, if you want to learn
46
- what it does, or if you prefer defining your settings explicitly, read below.
40
+ Automatic setup
41
+ ---------------
42
+
43
+ If you just add the Debug Toolbar to the ``INSTALLED_APPS `` setting as shown
44
+ above, when the ``DEBUG `` setting is ``True ``, the Debug Toolbar will attempt
45
+ to patch your settings to configure itself automatically.
47
46
48
47
.. warning ::
49
48
49
+ The automatic setup is known to interfere with the start-up sequence of
50
+ some projects and to prevent them from loading or functioning properly.
51
+
52
+ **The explicit setup described below is recommended for all but the most
53
+ trivial projects. The automatic setup is kept for backwards-compatibility. **
54
+
55
+ .. note ::
56
+
50
57
The automatic setup imports your project's URLconf in order to add the
51
- Debug Toolbar's URLs. This may trigger circular imports, for instance when
52
- the URLconf imports views that import models. If the development server
53
- crashes with a long stack trace after hitting an :exc: `ImportError ` or an
54
- :exc: `~django.core.exceptions.ImproperlyConfigured ` exception, follow the
55
- explicit setup instructions.
58
+ Debug Toolbar's URLs. This is likely to trigger circular imports, for
59
+ instance when the URLconf imports views that import models, a pattern
60
+ found in almost every Django project.
61
+
62
+ If the development server crashes with a long stack trace after hitting an
63
+ :exc: `ImportError `, an :exc: `~django.apps.exceptions.AppRegistryNotReady `
64
+ or an :exc: `~django.core.exceptions.ImproperlyConfigured ` exception, use
65
+ the explicit setup described below.
56
66
57
67
When the automatic setup is used, the Debug Toolbar is not compatible with
58
68
:class: `~django.middleware.gzip.GZipMiddleware `. Please disable that
@@ -62,8 +72,8 @@ what it does, or if you prefer defining your settings explicitly, read below.
62
72
Explicit setup
63
73
--------------
64
74
65
- First, tell the toolbar not to adjust your settings automatically by adding
66
- this line in your settings module::
75
+ This is the recommended way to configure the Debug Toolbar. First, disable the
76
+ automatic setup by adding this line in your settings module::
67
77
68
78
DEBUG_TOOLBAR_PATCH_SETTINGS = False
69
79
@@ -85,8 +95,9 @@ This example uses the ``__debug__`` prefix, but you can use any prefix that
85
95
doesn't clash with your application's URLs. Note the lack of quotes around
86
96
``debug_toolbar.urls ``.
87
97
88
- If the URLs aren't included in your root URLconf, the Debug Toolbar
89
- automatically appends them.
98
+ .. note ::
99
+
100
+ The automatic setup appends the Debug Toolbar URLs to the root URLconf.
90
101
91
102
Middleware
92
103
~~~~~~~~~~
@@ -105,8 +116,10 @@ Toolbar middleware as early as possible in the list. However, it must come
105
116
after any other middleware that encodes the response's content, such as
106
117
:class: `~django.middleware.gzip.GZipMiddleware `.
107
118
108
- If ``MIDDLEWARE_CLASSES `` doesn't contain the middleware, the Debug Toolbar
109
- automatically adds it the beginning of the list.
119
+ .. note ::
120
+
121
+ The automatic setup inserts the Debug Toolbar middleware at the beginning
122
+ of ``MIDDLEWARE_CLASSES ``, unless it's already included.
110
123
111
124
Internal IPs
112
125
~~~~~~~~~~~~
@@ -116,5 +129,7 @@ setting. (You can change this logic with the ``SHOW_TOOLBAR_CALLBACK``
116
129
option.) For local development, you should add ``'127.0.0.1' `` to
117
130
``INTERNAL_IPS ``.
118
131
119
- If ``INTERNAL_IPS `` is empty, the Debug Toolbar automatically sets it to
120
- ``'127.0.0.1' `` and ``'::1' ``.
132
+ .. note ::
133
+
134
+ The automatic setup sets ``INTERNAL_IPS `` to ``'127.0.0.1' `` and
135
+ ``'::1' ``, unless it's already set to a non-empty value.
0 commit comments