Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 931 lines (625 sloc) 30.05 kB
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
1 ====================
2 Appendix D: Settings
3 ====================
4
5 Your Django settings file contains all the configuration of your Django
6 installation. This appendix explains how settings work and which settings are
7 available.
8
9 What's a Settings File?
10 =======================
11
12 A *settings file* is just a Python module with module-level variables.
13
14 Here are a couple of example settings::
15
16 DEBUG = False
17 DEFAULT_FROM_EMAIL = 'webmaster@example.com'
18 TEMPLATE_DIRS = ('/home/templates/mike', '/home/templates/john')
19
20 Because a settings file is a Python module, the following apply:
21
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
22 * It must be valid Python code; syntax errors aren't allowed.
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
23
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
24 * It can assign settings dynamically using normal Python syntax,
25 for example::
26
27 MY_SETTING = [str(i) for i in range(30)]
28
29 * It can import values from other settings files.
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
30
31 Default Settings
32 ----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
33
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
34 A Django settings file doesn't have to define any settings if it doesn't need
35 to. Each setting has a sensible default value. These defaults live in the file
36 ``django/conf/global_settings.py``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
37
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
38 Here's the algorithm Django uses in compiling settings:
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
39
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
40 * Load settings from ``global_settings.py``.
41 * Load settings from the specified settings file, overriding the global
42 settings as necessary.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
43
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
44 Note that a settings file should *not* import from ``global_settings``, because
45 that's redundant.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
46
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
47 Seeing Which Settings You've Changed
48 ------------------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
49
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
50 There's an easy way to view which of your settings deviate from the default
51 settings. The command ``manage.py diffsettings`` displays differences between
52 the current settings file and Django's default settings.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
53
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
54 ``manage.py`` is described in more detail in Appendix F.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
55
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
56 Using Settings in Python Code
57 -----------------------------
58
59 In your Django applications, use settings by importing the object
60 ``django.conf.settings``, for example::
61
62 from django.conf import settings
63
64 if settings.DEBUG:
65 # Do something
66
67 Note that ``django.conf.settings`` isn't a module -- it's an object. So
68 importing individual settings is not possible::
69
70 from django.conf.settings import DEBUG # This won't work.
71
72 Also note that your code should *not* import from either ``global_settings`` or
73 your own settings file. ``django.conf.settings`` abstracts the concepts of
74 default settings and site-specific settings; it presents a single interface.
75 It also decouples the code that uses settings from the location of your
76 settings.
77
78 Altering Settings at Runtime
79 ----------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
80
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
81 You shouldn't alter settings in your applications at runtime. For example,
82 don't do this in a view::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
83
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
84 from django.conf import settings
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
85
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
86 settings.DEBUG = True # Don't do this!
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
87
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
88 The only place that settings should be defined in is a settings file.
89
90 Security
91 --------
92
93 Because a settings file contains sensitive information, such as the database
94 password, you should make every attempt to limit access to it. For example,
95 change its file permissions so that only you and your Web server's user can
96 read it. This is especially important in a shared-hosting environment.
97
98 Creating Your Own Settings
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
99 --------------------------
100
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
101 There's nothing stopping you from creating your own settings, for your own
102 Django applications. Just follow these conventions:
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
103
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
104 * Use all uppercase for setting names.
105
106 * For settings that are sequences, use tuples instead of lists. Settings
107 should be considered immutable and shouldn't be changed once they're
108 defined. Using tuples mirrors these semantics.
109
110 * Don't reinvent an already existing setting.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
111
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
112 Designating the Settings: DJANGO_SETTINGS_MODULE
113 ================================================
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
114
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
115 When you use Django, you have to tell it which settings you're using. Do this
116 by using the environment variable ``DJANGO_SETTINGS_MODULE``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
117
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
118 The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax (e.g.,
119 ``mysite.settings``). Note that the settings module should be on the
120 Python import search path (``PYTHONPATH``).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
121
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
122 .. admonition:: Tip:
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
123
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
124 A good guide to ``PYTHONPATH`` can be found at
125 http://diveintopython.org/getting_to_know_python/everything_is_an_object.html.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
126
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
127 The django-admin.py Utility
128 ---------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
129
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
130 When using ``django-admin.py`` (see Appendix F), you can either set the
131 environment variable once or explicitly pass in the settings module each time
132 you run the utility.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
133
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
134 Here's an example using the Unix Bash shell::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
135
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
136 export DJANGO_SETTINGS_MODULE=mysite.settings
137 django-admin.py runserver
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
138
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
139 Here's an example using the Windows shell::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
140
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
141 set DJANGO_SETTINGS_MODULE=mysite.settings
142 django-admin.py runserver
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
143
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
144 Use the ``--settings`` command-line argument to specify the settings manually::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
145
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
146 django-admin.py runserver --settings=mysite.settings
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
147
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
148 The ``manage.py`` utility created by ``startproject`` as part of the project
149 skeleton sets ``DJANGO_SETTINGS_MODULE`` automatically; see Appendix F for more
150 about ``manage.py``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
151
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
152 On the Server (mod_python)
153 --------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
154
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
155 In your live server environment, you'll need to tell Apache/mod_python which
156 settings file to use. Do that with ``SetEnv``::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
157
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
158 <Location "/mysite/">
159 SetHandler python-program
160 PythonHandler django.core.handlers.modpython
161 SetEnv DJANGO_SETTINGS_MODULE mysite.settings
162 </Location>
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
163
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
164 For more information, read the Django mod_python documentation online at
165 http://docs.djangoproject.com/en/dev/howto/deployment/modpython/.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
166
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
167 Using Settings Without Setting DJANGO_SETTINGS_MODULE
168 =====================================================
169
170 In some cases, you might want to bypass the ``DJANGO_SETTINGS_MODULE``
171 environment variable. For example, if you're using the template system by
172 itself, you likely don't want to have to set up an environment variable
173 pointing to a settings module.
174
175 In these cases, you can configure Django's settings manually. Do this by
176 calling ``django.conf.settings.configure()``. Here's an example::
177
178 from django.conf import settings
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
179
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
180 settings.configure(
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
181 DEBUG = True,
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
182 TEMPLATE_DEBUG = True,
183 TEMPLATE_DIRS = [
184 '/home/web-apps/myapp',
185 '/home/web-apps/base',
186 ]
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
187 )
188
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
189 Pass ``configure()`` as many keyword arguments as you'd like, with each keyword
190 argument representing a setting and its value. Each argument name should be all
191 uppercase, with the same name as the settings described earlier. If a particular
192 setting is not passed to ``configure()`` and is needed at some later point,
193 Django will use the default setting value.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
194
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
195 Configuring Django in this fashion is mostly necessary -- and, indeed,
196 recommended -- when you're using a piece of the framework inside a larger
197 application.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
198
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
199 Consequently, when configured via ``settings.configure()``, Django will not
200 make any modifications to the process environment variables. (See the
201 explanation of ``TIME_ZONE`` later in this appendix for why this would normally occur.)
202 It's assumed that you're already in full control of your environment in these cases.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
203
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
204 Custom Default Settings
205 -----------------------
206
207 If you'd like default values to come from somewhere other than
208 ``django.conf.global_settings``, you can pass in a module or class that
209 provides the default settings as the ``default_settings`` argument (or as the
210 first positional argument) in the call to ``configure()``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
211
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
212 In this example, default settings are taken from ``myapp_defaults``, and the
213 ``DEBUG`` setting is set to ``True``, regardless of its value in
214 ``myapp_defaults``::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
215
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
216 from django.conf import settings
217 from myapp import myapp_defaults
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
218
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
219 settings.configure(default_settings=myapp_defaults, DEBUG=True)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
220
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
221 The following example, which uses ``myapp_defaults`` as a positional argument,
222 is equivalent::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
223
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
224 settings.configure(myapp_defaults, DEBUG = True)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
225
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
226 Normally, you will not need to override the defaults in this fashion. The
227 Django defaults are sufficiently tame that you can safely use them. Be aware
228 that if you do pass in a new default module, it entirely *replaces* the Django
229 defaults, so you must specify a value for every possible setting that might be
230 used in that code you are importing. Check in
231 ``django.conf.settings.global_settings`` for the full list.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
232
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
233 Either configure() or DJANGO_SETTINGS_MODULE Is Required
234 --------------------------------------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
235
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
236 If you're not setting the ``DJANGO_SETTINGS_MODULE`` environment variable, you
237 *must* call ``configure()`` at some point before using any code that reads
238 settings.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
239
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
240 If you don't set ``DJANGO_SETTINGS_MODULE`` and don't call ``configure()``,
241 Django will raise an ``EnvironmentError`` exception the first time a setting
242 is accessed.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
243
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
244 If you set ``DJANGO_SETTINGS_MODULE``, access settings values somehow, and *then*
245 call ``configure()``, Django will raise an ``EnvironmentError`` stating that settings
246 have already been configured.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
247
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
248 Also, it's an error to call ``configure()`` more than once, or to call
249 ``configure()`` after any setting has been accessed.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
250
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
251 It boils down to this: use exactly one of either ``configure()`` or
252 ``DJANGO_SETTINGS_MODULE``, and only once.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
253
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
254 Available Settings
255 ==================
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
256
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
257 The following sections consist of a list of the main available settings,
258 in alphabetical order, and their default values.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
259
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
260 ABSOLUTE_URL_OVERRIDES
261 ----------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
262
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
263 *Default*: ``{}`` (empty dictionary)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
264
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
265 This is a dictionary mapping ``"app_label.model_name"`` strings to functions that take
266 a model object and return its URL. This is a way of overriding
267 ``get_absolute_url()`` methods on a per-installation basis. Here's an example::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
268
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
269 ABSOLUTE_URL_OVERRIDES = {
270 'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
271 'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
272 }
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
273
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
274 Note that the model name used in this setting should be all lowercase, regardless
275 of the case of the actual model class name.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
276
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
277 ADMIN_MEDIA_PREFIX
278 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
279
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
280 *Default*: ``'/media/'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
281
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
282 This setting is the URL prefix for admin media: CSS, JavaScript, and images.
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
283 Make sure to use a trailing slash.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
284
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
285 ADMINS
286 ------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
287
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
288 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
289
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
290 This is a tuple that lists people who get code error notifications. When
291 ``DEBUG=False`` and a view raises an exception, Django will email these people
292 with the full exception information. Each member of the tuple should be a tuple
293 of (Full name, e-mail address), for example::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
294
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
295 (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
296
297 Note that Django will email *all* of these people whenever an error happens.
298
299 ALLOWED_INCLUDE_ROOTS
300 ---------------------
301
302 *Default*: ``()`` (empty tuple)
303
304 This is a tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
305 tag. This is a security measure, so that template authors can't access files
306 that they shouldn't be accessing.
307
308 For example, if ``ALLOWED_INCLUDE_ROOTS`` is ``('/home/html', '/var/www')``,
309 then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
310 wouldn't.
311
312 APPEND_SLASH
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
313 ------------
314
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
315 *Default*: ``True``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
316
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
317 This setting indicates whether to append trailing slashes to URLs. This is used only if
318 ``CommonMiddleware`` is installed (see Chapter 17). See also ``PREPEND_WWW``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
319
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
320 CACHE_BACKEND
321 -------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
322
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
323 *Default*: ``'locmem://'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
324
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
325 This is the cache back-end to use (see Chapter 15).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
326
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
327 CACHE_MIDDLEWARE_KEY_PREFIX
328 ---------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
329
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
330 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
331
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
332 This is the cache key prefix that the cache middleware should use (see Chapter 15).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
333
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
334 DATABASE_ENGINE
335 ---------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
336
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
337 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
338
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
339 This setting indicates which database back-end to use, e.g.
340 ``'postgresql_psycopg2'``, or ``'mysql'``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
341
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
342 DATABASE_HOST
343 -------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
344
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
345 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
346
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
347 This setting indicates which host to use when connecting to the database.
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
348 An empty string means ``localhost``. This is not used with SQLite.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
349
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
350 If this value starts with a forward slash (``'/'``) and you're using MySQL,
351 MySQL will connect via a Unix socket to the specified socket::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
352
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
353 DATABASE_HOST = '/var/run/mysql'
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
354
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
355 If you're using MySQL and this value *doesn't* start with a forward slash, then
356 this value is assumed to be the host.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
357
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
358 DATABASE_NAME
359 -------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
360
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
361 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
362
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
363 This is the name of the database to use. For SQLite, it's the full path to the database
364 file.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
365
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
366 DATABASE_OPTIONS
367 ----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
368
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
369 *Default*: ``{}`` (empty dictionary)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
370
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
371 This is extra parameters to use when connecting to the database. Consult the back-end
372 module's document for available keywords.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
373
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
374 DATABASE_PASSWORD
375 -----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
376
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
377 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
378
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
379 This setting is the password to use when connecting to the database. It is not used with SQLite.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
380
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
381 DATABASE_PORT
382 -------------
383
384 *Default*: ``''`` (empty string)
385
386 This is the port to use when connecting to the database. An empty string means the
387 default port. It is not used with SQLite.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
388
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
389 DATABASE_USER
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
390 -------------
391
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
392 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
393
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
394 This setting is the username to use when connecting to the database. It is not used with SQLite.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
395
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
396 DATE_FORMAT
397 -----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
398
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
399 *Default*: ``'N j, Y'`` (e.g., ``Feb. 4, 2003``)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
400
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
401 This is the default formatting to use for date fields on Django admin change-list pages
402 -- and, possibly, by other parts of the system. It accepts the same format as the
403 ``now`` tag (see Appendix E, Table E-2).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
404
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
405 See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``, and
406 ``MONTH_DAY_FORMAT``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
407
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
408 DATETIME_FORMAT
409 ---------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
410
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
411 *Default*: ``'N j, Y, P'`` (e.g., ``Feb. 4, 2003, 4 p.m.``)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
412
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
413 This is the default formatting to use for datetime fields on Django admin change-list
414 pages -- and, possibly, by other parts of the system. It accepts the same format as the
415 ``now`` tag (see Appendix E, Table E-2).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
416
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
417 See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
418 ``YEAR_MONTH_FORMAT``, and ``MONTH_DAY_FORMAT``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
419
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
420 DEBUG
421 -----
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
422
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
423 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
424
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
425 This setting is a Boolean that turns debug mode on and off.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
426
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
427 If you define custom settings, ``django/views/debug.py`` has a ``HIDDEN_SETTINGS``
428 regular expression that will hide from the ``DEBUG`` view anything that contains
429 ``'SECRET``, ``PASSWORD``, or ``PROFANITIES'``. This allows untrusted users to
430 be able to give backtraces without seeing sensitive (or offensive) settings.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
431
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
432 Still, note that there are always going to be sections of your debug output that
433 are inappropriate for public consumption. File paths, configuration options, and
434 the like all give attackers extra information about your server. Never deploy a
435 site with ``DEBUG`` turned on.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
436
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
437 DEFAULT_CHARSET
438 ---------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
439
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
440 *Default*: ``'utf-8'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
441
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
442 This is the default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
443 manually specified. It is used with ``DEFAULT_CONTENT_TYPE`` to construct the
444 ``Content-Type`` header. See Appendix G for more about ``HttpResponse`` objects.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
445
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
446 DEFAULT_CONTENT_TYPE
447 --------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
448
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
449 *Default*: ``'text/html'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
450
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
451 This is the default content type to use for all ``HttpResponse`` objects, if a MIME type
452 isn't manually specified. It is used with ``DEFAULT_CHARSET`` to construct the
453 ``Content-Type`` header. See Appendix G for more about ``HttpResponse`` objects.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
454
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
455 DEFAULT_FROM_EMAIL
456 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
457
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
458 *Default*: ``'webmaster@localhost'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
459
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
460 This is the default email address to use for various automated correspondence from the
461 site manager(s).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
462
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
463 DISALLOWED_USER_AGENTS
464 ----------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
465
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
466 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
467
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
468 This is a list of compiled regular expression objects representing User-Agent strings
469 that are not allowed to visit any page, systemwide. Use this for bad
470 robots/crawlers. This is used only if ``CommonMiddleware`` is installed (see
471 Chapter 17).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
472
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
473 EMAIL_HOST
474 ----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
475
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
476 *Default*: ``'localhost'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
477
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
478 This is the host to use for sending email. See also ``EMAIL_PORT``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
479
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
480 EMAIL_HOST_PASSWORD
481 -------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
482
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
483 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
484
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
485 This is the password to use for the SMTP server defined in ``EMAIL_HOST``. This setting is
486 used in conjunction with ``EMAIL_HOST_USER`` when authenticating to the SMTP
487 server. If either of these settings is empty, Django won't attempt
488 authentication.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
489
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
490 See also ``EMAIL_HOST_USER``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
491
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
492 EMAIL_HOST_USER
493 ---------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
494
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
495 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
496
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
497 This is the username to use for the SMTP server defined in ``EMAIL_HOST``. If it's empty,
498 Django won't attempt authentication. See also ``EMAIL_HOST_PASSWORD``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
499
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
500 EMAIL_PORT
501 ----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
502
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
503 *Default*: ``25``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
504
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
505 This is the port to use for the SMTP server defined in ``EMAIL_HOST``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
506
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
507 EMAIL_SUBJECT_PREFIX
508 --------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
509
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
510 *Default*: ``'[Django] '``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
511
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
512 This is the subject-line prefix for email messages sent with ``django.core.mail.mail_admins``
513 or ``django.core.mail.mail_managers``. You'll probably want to include the
514 trailing space.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
515
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
516 FIXTURE_DIRS
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
517 -------------
518
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
519 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
520
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
521 This is a list of locations of the fixture data files, in search order. Note that these
522 paths should use Unix-style forward slashes, even on Windows. It is used by Django's
523 testing framework, which is covered online at
524 http://docs.djangoproject.com/en/dev/topics/testing/.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
525
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
526 IGNORABLE_404_ENDS
527 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
528
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
529 *Default*: ``('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
530 '.php')``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
531
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
532 This is a tuple of strings that specify beginnings of URLs that should be
533 ignored by the 404 e-mailer. (See Chapter 12 for more on the 404 e-mailer.)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
534
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
535 No errors will be sent for URLs end with strings from this sequence.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
536
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
537 See also ``IGNORABLE_404_STARTS`` and ``SEND_BROKEN_LINK_EMAILS``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
538
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
539 IGNORABLE_404_STARTS
540 --------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
541
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
542 *Default*: ``('/cgi-bin/', '/_vti_bin', '/_vti_inf')``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
543
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
544 See also ``SEND_BROKEN_LINK_EMAILS`` and ``IGNORABLE_404_ENDS``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
545
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
546 INSTALLED_APPS
547 --------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
548
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
549 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
550
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
551 A tuple of strings designating all applications that are enabled in this Django
552 installation. Each string should be a full Python path to a Python package that
553 contains a Django application. See Chapter 5 for more about applications.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
554
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
555 LANGUAGE_CODE
556 -------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
557
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
558 *Default*: ``'en-us'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
559
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
560 This is a string representing the language code for this installation. This should be
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
561 in standard language format -- for example, U.S. English is ``"en-us"``. See
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
562 Chapter 19.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
563
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
564 LANGUAGES
565 ---------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
566
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
567 *Default*: A tuple of all available languages. This list is continually growing
568 and any copy included here would inevitably become rapidly out of date. You can
569 see the current list of translated languages by looking in
570 ``django/conf/global_settings.py``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
571
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
572 The list is a tuple of two-tuples in the format (language code, language name)
573 -- for example, ``('ja', 'Japanese')``. This specifies which languages are
574 available for language selection. See Chapter 19 for more on language selection.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
575
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
576 Generally, the default value should suffice. Only set this setting if you want
577 to restrict language selection to a subset of the Django-provided languages.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
578
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
579 If you define a custom ``LANGUAGES`` setting, it's OK to mark the languages as
580 translation strings, but you should *never* import ``django.utils.translation``
581 from within your settings file, because that module in itself depends on the
582 settings, and that would cause a circular import.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
583
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
584 The solution is to use a "dummy" ``gettext()`` function. Here's a sample
585 settings file::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
586
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
587 gettext = lambda s: s
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
588
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
589 LANGUAGES = (
590 ('de', gettext('German')),
591 ('en', gettext('English')),
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
592 )
593
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
594 With this arrangement, ``make-messages.py`` will still find and mark these
595 strings for translation, but the translation won't happen at runtime -- so
596 you'll have to remember to wrap the languages in the *real* ``gettext()`` in
597 any code that uses ``LANGUAGES`` at runtime.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
598
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
599 MANAGERS
600 --------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
601
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
602 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
603
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
604 This tuple is in the same format as ``ADMINS`` that specifies who should get
605 broken-link notifications when ``SEND_BROKEN_LINK_EMAILS=True``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
606
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
607 MEDIA_ROOT
608 ----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
609
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
610 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
611
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
612 This is an absolute path to the directory that holds media for this installation (e.g.,
613 ``"/home/media/media.lawrence.com/"``). See also ``MEDIA_URL``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
614
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
615 MEDIA_URL
616 ---------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
617
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
618 *Default*: ``''`` (empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
619
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
620 This URL handles the media served from ``MEDIA_ROOT`` (e.g.,
621 ``"http://media.lawrence.com"``).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
622
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
623 Note that this should have a trailing slash if it has a path component:
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
624
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
625 * *Correct*: ``"http://www.example.com/static/"``
626 * *Incorrect*: ``"http://www.example.com/static"``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
627
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
628 See Chapter 12 for more on deployment and serving media.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
629
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
630 MIDDLEWARE_CLASSES
631 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
632
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
633 *Default*::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
634
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
635 ("django.contrib.sessions.middleware.SessionMiddleware",
636 "django.contrib.auth.middleware.AuthenticationMiddleware",
637 "django.middleware.common.CommonMiddleware",
638 "django.middleware.doc.XViewMiddleware")
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
639
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
640 This is a tuple of middleware classes to use. See Chapter 17.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
641
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
642 MONTH_DAY_FORMAT
643 ----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
644
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
645 *Default*: ``'F j'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
646
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
647 This is the default formatting to use for date fields on Django admin change-list
648 pages -- and, possibly, by other parts of the system -- in cases when only the
649 month and day are displayed. It accepts the same format as the
650 ``now`` tag (see Appendix E, Table E-2).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
651
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
652 For example, when a Django admin change-list page is being filtered by a date,
653 the header for a given day displays the day and month. Different locales have
654 different formats. For example, U.S. English would have "January 1," whereas
655 Spanish might have "1 Enero."
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
656
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
657 See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``, and
658 ``YEAR_MONTH_FORMAT``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
659
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
660 PREPEND_WWW
661 -----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
662
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
663 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
664
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
665 This setting indicates whether to prepend the "www." subdomain to URLs that don't have it.
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
666 This is used only if ``CommonMiddleware`` is installed (see the Chapter 17). See also
667 ``APPEND_SLASH``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
668
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
669 ROOT_URLCONF
670 ------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
671
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
672 *Default*: Not defined
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
673
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
674 This is a string representing the full Python import path to your root URLconf (e.g.,
675 ``"mydjangoapps.urls"``). See Chapter 3.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
676
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
677 SECRET_KEY
678 ----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
679
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
680 *Default*: (Generated automatically when you start a project)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
681
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
682 This is a secret key for this particular Django installation. It is used to provide a seed in
683 secret-key hashing algorithms. Set this to a random string -- the longer, the
684 better. ``django-admin.py startproject`` creates one automatically and most
685 of the time you won't need to change it
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
686
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
687 SEND_BROKEN_LINK_EMAILS
688 -----------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
689
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
690 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
691
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
692 This setting indicates whether to send an email to the ``MANAGERS`` each time somebody visits a
693 Django-powered page that is 404-ed with a nonempty referer (i.e., a broken
694 link). This is only used if ``CommonMiddleware`` is installed (see Chapter 17).
695 See also ``IGNORABLE_404_STARTS`` and ``IGNORABLE_404_ENDS``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
696
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
697 SERIALIZATION_MODULES
698 ---------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
699
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
700 *Default*: Not defined.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
701
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
702 Serialization is a feature still under heavy development. Refer to the online
703 documentation at http://docs.djangoproject.com/en/dev/topics/serialization/
704 for more information.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
705
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
706 SERVER_EMAIL
707 ------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
708
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
709 *Default*: ``'root@localhost'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
710
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
711 This is the email address that error messages come from, such as those sent to
712 ``ADMINS`` and ``MANAGERS``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
713
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
714 SESSION_COOKIE_AGE
715 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
716
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
717 *Default*: ``1209600`` (two weeks, in seconds)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
718
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
719 This is the age of session cookies, in seconds. See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
720
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
721 SESSION_COOKIE_DOMAIN
722 ---------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
723
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
724 *Default*: ``None``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
725
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
726 This is the domain to use for session cookies. Set this to a string such as
727 ``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard
728 domain cookie. See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
729
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
730 SESSION_COOKIE_NAME
731 -------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
732
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
733 *Default*: ``'sessionid'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
734
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
735 This is the name of the cookie to use for sessions; it can be whatever you want.
736 See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
737
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
738 SESSION_COOKIE_SECURE
739 ---------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
740
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
741 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
742
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
743 This setting indicates whether to use a secure cookie for the session cookie.
744 If this is set to ``True``, the cookie will be marked as "secure,"
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
745 which means browsers may ensure that the cookie is only sent under an HTTPS connection.
746 See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
747
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
748 SESSION_EXPIRE_AT_BROWSER_CLOSE
749 -------------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
750
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
751 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
752
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
753 This setting indicates whether to expire the session when the user closes
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
754 his browser. See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
755
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
756 SESSION_SAVE_EVERY_REQUEST
757 --------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
758
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
759 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
760
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
761 This setting indicates whether to save the session data on every request. See Chapter 14.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
762
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
763 SITE_ID
764 -------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
765
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
766 *Default*: Not defined
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
767
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
768 This is the ID, as an integer, of the current site in the ``django_site`` database
769 table. It is used so that application data can hook into specific site(s)
770 and a single database can manage content for multiple sites. See Chapter 16.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
771
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
772 TEMPLATE_CONTEXT_PROCESSORS
773 ---------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
774
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
775 *Default*::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
776
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
777 ("django.core.context_processors.auth",
778 "django.core.context_processors.debug",
779 "django.core.context_processors.i18n",
780 "django.core.context_processors.media")
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
781
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
782 This is a tuple of callables that are used to populate the context in ``RequestContext``.
783 These callables take a request object as their argument and return a dictionary
784 of items to be merged into the context. See Chapter 9.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
785
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
786 TEMPLATE_DEBUG
787 --------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
788
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
789 *Default*: ``False``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
790
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
791 This Boolean turns template debug mode on and off. If it is ``True``, the fancy
792 error page will display a detailed report for any ``TemplateSyntaxError``. This
793 report contains the relevant snippet of the template, with the appropriate line
794 highlighted.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
795
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
796 Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so
797 you'll want to set that to take advantage of this setting.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
798
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
799 See also ``DEBUG``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
800
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
801 TEMPLATE_DIRS
802 -------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
803
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
804 *Default*: ``()`` (empty tuple)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
805
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
806 This is a list of locations of the template source files, in search order. Note that these
807 paths should use Unix-style forward slashes, even on Windows. See Chapters 4 and
808 9.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
809
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
810 TEMPLATE_LOADERS
811 ----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
812
fdc4800 @jacobian Fixed a bunch of reST markup errors.
jacobian authored
813 *Default*::
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
814
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
815 ('django.template.loaders.filesystem.load_template_source',
816 'django.template.loaders.app_directories.load_template_source')
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
817
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
818 This is a tuple of callables (as strings) that know how to import templates from
819 various sources. See Chapter 9.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
820
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
821 TEMPLATE_STRING_IF_INVALID
822 --------------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
823
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
824 *Default*: ``''`` (Empty string)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
825
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
826 This is output, as a string, that the template system should use for invalid (e.g.,
827 misspelled) variables. See Chapter 9.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
828
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
829 TEST_RUNNER
830 -----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
831
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
832 *Default*: ``'django.test.simple.run_tests'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
833
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
834 This is the name of the method to use for starting the test suite. It is used by Django's
835 testing framework, which is covered online at
836 http://docs.djangoproject.com/en/dev/topics/testing/.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
837
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
838 TEST_DATABASE_NAME
839 ------------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
840
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
841 *Default*: ``None``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
842
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
843 This is the name of database to use when running the test suite. If a value of ``None``
844 is specified, the test database will use the name ``'test_' +
845 settings.DATABASE_NAME``. See the documentation for Django's testing framework,
846 which is covered online at http://docs.djangoproject.com/en/dev/topics/testing/.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
847
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
848 TIME_FORMAT
849 -----------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
850
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
851 *Default*: ``'P'`` (e.g., ``4 p.m.``)
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
852
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
853 This is the default formatting to use for time fields on Django admin change-list pages
854 -- and, possibly, by other parts of the system. It accepts the same format as the
855 ``now`` tag (see Appendix E, Table E-2).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
856
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
857 See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
858 ``YEAR_MONTH_FORMAT``, and ``MONTH_DAY_FORMAT``.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
859
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
860 TIME_ZONE
861 ---------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
862
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
863 *Default*: ``'America/Chicago'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
864
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
865 This is a string representing the time zone for this installation. Time zones are in the
866 Unix-standard ``zic`` format. One relatively complete list of time zone strings
867 can be found at
868 http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
869
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
870 This is the time zone to which Django will convert all dates/times --
871 not necessarily the time zone of the server. For example, one server may serve
872 multiple Django-powered sites, each with a separate time-zone setting.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
873
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
874 Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you
875 specify in the ``TIME_ZONE`` setting. Thus, all your views and models will
876 automatically operate in the correct time zone. However, if you're using the
877 manually configuring settings (described above in the section titled "Using
878 Settings Without Setting DJANGO_SETTINGS_MODULE"), Django will *not* touch the
879 ``TZ`` environment variable, and it will be up to you to ensure your processes
880 are running in the correct environment.
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
881
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
882 .. note::
883 Django cannot reliably use alternate time zones in a Windows environment. If
884 you're running Django on Windows, this variable must be set to match the
885 system time zone.
886
887 URL_VALIDATOR_USER_AGENT
888 ------------------------
889
890 *Default*: ``Django/<version> (http://www.djangoproject.com/)``
891
892 This is the string to use as the ``User-Agent`` header when checking to see if URLs
893 exist (see the ``verify_exists`` option on ``URLField``; see Appendix A).
894
895 USE_ETAGS
896 ---------
897
898 *Default*: ``False``
899
900 This Boolean specifies whether to output the ETag header. It saves
901 bandwidth but slows down performance. This is only used if ``CommonMiddleware``
902 is installed (see Chapter 17).
903
904 USE_I18N
905 --------
906
907 *Default*: ``True``
908
909 This Boolean specifies whether Django's internationalization system (see
910 Chapter 19) should be enabled. It provides an easy way to turn off internationalization, for
911 performance. If this is set to ``False``, Django will make some optimizations so
912 as not to load the internationalization machinery.
913
914 YEAR_MONTH_FORMAT
915 -----------------
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
916
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
917 *Default*: ``'F Y'``
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
918
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
919 This is the default formatting to use for date fields on Django admin change-list pages
920 -- and, possibly, by other parts of the system -- in cases when only the year
921 and month are displayed. It accepts the same format as the ``now`` tag (see
922 Appendix E).
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
923
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
924 For example, when a Django admin change-list page is being filtered by a date
925 drill-down, the header for a given month displays the month and the year.
926 Different locales have different formats. For example, U.S. English would use
927 "January 2006," whereas another locale might use "2006/January."
acc918f @jacobian Initial import of djangobook from private SVN repo.
jacobian authored
928
d40cfe7 @jacobian Restored *2.0* version of the book, not 1.0!
jacobian authored
929 See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``, and
930 ``MONTH_DAY_FORMAT``.
Something went wrong with that request. Please try again.