Ticket #15992: 15992.patch
File 15992.patch, 60.7 KB (added by , 14 years ago) |
---|
-
docs/internals/contributing.txt
1004 1004 1005 1005 You will also need to ensure that your database uses UTF-8 as the default 1006 1006 character set. If your database server doesn't use UTF-8 as a default charset, 1007 you will need to include a value for ``TEST_CHARSET`` in the settings1007 you will need to include a value for :setting:`TEST_CHARSET` in the settings 1008 1008 dictionary for the applicable database. 1009 1009 1010 1010 Running only some of the tests -
docs/internals/documentation.txt
34 34 The main thing to keep in mind as you write and edit docs is that the more 35 35 semantic markup you can add the better. So:: 36 36 37 Add ``django.contrib.auth`` to your ``INSTALLED_APPS``...37 Add ``django.contrib.auth`` to your :setting:`INSTALLED_APPS`... 38 38 39 39 Isn't nearly as helpful as:: 40 40 -
docs/internals/deprecation.txt
170 170 and :class:`django.contrib.auth.context_processors.PermLookupDict`, 171 171 respectively. 172 172 173 * The ``MEDIA_URL`` or ``STATIC_URL`` settings are required to end174 with a trailing slash to ensure there is a consistent way to175 combine paths in templates.173 * The :setting:`MEDIA_URL` or :setting:`STATIC_URL` settings are 174 required to end with a trailing slash to ensure there is a consistent 175 way to combine paths in templates. 176 176 177 177 * 1.6 178 178 * The compatibility modules ``django.utils.copycompat`` and -
docs/howto/i18n.txt
55 55 56 56 All message file repositories are structured the same way. They are: 57 57 58 * All paths listed in ``LOCALE_PATHS`` in your settings file are58 * All paths listed in :setting:`LOCALE_PATHS` in your settings file are 59 59 searched for ``<language>/LC_MESSAGES/django.(po|mo)`` 60 60 * ``$PROJECTPATH/locale/<language>/LC_MESSAGES/django.(po|mo)`` -- 61 61 deprecated, see above. -
docs/topics/i18n/internationalization.txt
547 547 548 548 Each ``RequestContext`` has access to three translation-specific variables: 549 549 550 * ``LANGUAGES`` is a list of tuples in which the first element is the550 * :setting:`LANGUAGES` is a list of tuples in which the first element is the 551 551 :term:`language code` and the second is the language name (translated into 552 552 the currently active locale). 553 553 554 * ``LANGUAGE_CODE`` is the current user's preferred language, as a string.554 * :setting:`LANGUAGE_CODE` is the current user's preferred language, as a string. 555 555 Example: ``en-us``. (See :ref:`how-django-discovers-language-preference`.) 556 556 557 557 * ``LANGUAGE_BIDI`` is the current locale's direction. If True, it's a … … 675 675 ) 676 676 677 677 Each string in ``packages`` should be in Python dotted-package syntax (the 678 same format as the strings in ``INSTALLED_APPS``) and should refer to a package678 same format as the strings in :setting:`INSTALLED_APPS`) and should refer to a package 679 679 that contains a ``locale`` directory. If you specify multiple packages, all 680 680 those catalogs are merged into one catalog. This is useful if you have 681 681 JavaScript that uses strings from different applications. … … 708 708 later. 709 709 710 710 .. versionchanged:: 1.3 711 Directories listed in ``LOCALE_PATHS`` weren't included in the lookup711 Directories listed in :setting:`LOCALE_PATHS` weren't included in the lookup 712 712 algorithm until version 1.3. 713 713 714 714 Using the JavaScript translation catalog -
docs/topics/i18n/index.txt
104 104 variant on the provided English value. The format is identical to the format 105 105 strings used by the ``now`` template tag. 106 106 107 For example, with ``DATETIME_FORMAT`` (or ``DATE_FORMAT`` or ``TIME_FORMAT``),107 For example, with :setting:`DATETIME_FORMAT` (or :setting:`DATE_FORMAT` or :setting:`TIME_FORMAT`), 108 108 this would be the format string that you want to use in your language. A Django 109 109 contributor localizing it to Spanish probably would provide a ``"j N Y P"`` 110 110 "translation" for it in the relevant ``django.po`` file:: -
docs/topics/i18n/deployment.txt
13 13 optimizations so as not to load the internationalization machinery. 14 14 15 15 You'll probably also want to remove ``'django.core.context_processors.i18n'`` 16 from your ``TEMPLATE_CONTEXT_PROCESSORS`` setting.16 from your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting. 17 17 18 18 .. note:: 19 19 … … 47 47 other translator finds a translation. 48 48 49 49 If all you want to do is run Django with your native language, and a language 50 file is available for it, all you need to do is set ``LANGUAGE_CODE``.50 file is available for it, all you need to do is set :setting:`LANGUAGE_CODE`. 51 51 52 52 If you want to let each individual user specify which language he or she 53 53 prefers, use ``LocaleMiddleware``. ``LocaleMiddleware`` enables language 54 54 selection based on data from the request. It customizes content for each user. 55 55 56 56 To use ``LocaleMiddleware``, add ``'django.middleware.locale.LocaleMiddleware'`` 57 to your ``MIDDLEWARE_CLASSES`` setting. Because middleware order matters, you57 to your :setting:`MIDDLEWARE_CLASSES` setting. Because middleware order matters, you 58 58 should follow these guidelines: 59 59 60 60 * Make sure it's one of the first middlewares installed. … … 62 62 makes use of session data. 63 63 * If you use ``CacheMiddleware``, put ``LocaleMiddleware`` after it. 64 64 65 For example, your ``MIDDLEWARE_CLASSES`` might look like this::65 For example, your :setting:`MIDDLEWARE_CLASSES` might look like this:: 66 66 67 67 MIDDLEWARE_CLASSES = ( 68 68 'django.contrib.sessions.middleware.SessionMiddleware', … … 81 81 82 82 * Failing that, it looks for a cookie. 83 83 84 The name of the cookie used is set by the ``LANGUAGE_COOKIE_NAME``84 The name of the cookie used is set by the :setting:`LANGUAGE_COOKIE_NAME` 85 85 setting. (The default name is ``django_language``.) 86 86 87 87 * Failing that, it looks at the ``Accept-Language`` HTTP header. This … … 89 89 prefer, in order by priority. Django tries each language in the header 90 90 until it finds one with available translations. 91 91 92 * Failing that, it uses the global ``LANGUAGE_CODE`` setting.92 * Failing that, it uses the global :setting:`LANGUAGE_CODE` setting. 93 93 94 94 .. _locale-middleware-notes: 95 95 … … 107 107 * Only languages listed in the :setting:`LANGUAGES` setting can be selected. 108 108 If you want to restrict the language selection to a subset of provided 109 109 languages (because your application doesn't provide all those languages), 110 set ``LANGUAGES`` to a list of languages. For example::110 set :setting:`LANGUAGES` to a list of languages. For example:: 111 111 112 112 LANGUAGES = ( 113 113 ('de', _('German')), … … 118 118 selection to German and English (and any sublanguage, like de-ch or 119 119 en-us). 120 120 121 * If you define a custom ``LANGUAGES`` setting, as explained in the121 * If you define a custom :setting:`LANGUAGES` setting, as explained in the 122 122 previous bullet, it's OK to mark the languages as translation strings 123 123 -- but use a "dummy" ``ugettext()`` function, not the one in 124 124 ``django.utils.translation``. You should *never* import … … 139 139 With this arrangement, ``django-admin.py makemessages`` will still find 140 140 and mark these strings for translation, but the translation won't happen 141 141 at runtime -- so you'll have to remember to wrap the languages in the 142 *real* ``ugettext()`` in any code that uses ``LANGUAGES`` at runtime.142 *real* ``ugettext()`` in any code that uses :setting:`LANGUAGES` at runtime. 143 143 144 144 * The ``LocaleMiddleware`` can only select languages for which there is a 145 145 Django-provided base translation. If you want to provide translations -
docs/topics/http/file-uploads.txt
225 225 226 226 When a user uploads a file, Django passes off the file data to an *upload 227 227 handler* -- a small class that handles file data as it gets uploaded. Upload 228 handlers are initially defined in the ``FILE_UPLOAD_HANDLERS`` setting, which228 handlers are initially defined in the :setting:`FILE_UPLOAD_HANDLERS` setting, which 229 229 defaults to:: 230 230 231 231 ("django.core.files.uploadhandler.MemoryFileUploadHandler", … … 246 246 Sometimes particular views require different upload behavior. In these cases, 247 247 you can override upload handlers on a per-request basis by modifying 248 248 ``request.upload_handlers``. By default, this list will contain the upload 249 handlers given by ``FILE_UPLOAD_HANDLERS``, but you can modify the list as you249 handlers given by :setting:`FILE_UPLOAD_HANDLERS`, but you can modify the list as you 250 250 would any other list. 251 251 252 252 For instance, suppose you've written a ``ProgressBarUploadHandler`` that -
docs/topics/http/sessions.txt
17 17 18 18 To enable session functionality, do the following: 19 19 20 * Edit the ``MIDDLEWARE_CLASSES`` setting and make sure21 ``MIDDLEWARE_CLASSES`` contains ``'django.contrib.sessions.middleware.SessionMiddleware'``.20 * Edit the :setting:`MIDDLEWARE_CLASSES` setting and make sure 21 :setting:`MIDDLEWARE_CLASSES` contains ``'django.contrib.sessions.middleware.SessionMiddleware'``. 22 22 The default ``settings.py`` created by ``django-admin.py startproject`` has 23 23 ``SessionMiddleware`` activated. 24 24 25 25 If you don't want to use sessions, you might as well remove the 26 ``SessionMiddleware`` line from ``MIDDLEWARE_CLASSES`` and ``'django.contrib.sessions'``27 from your ``INSTALLED_APPS``. It'll save you a small bit of overhead.26 ``SessionMiddleware`` line from :setting:`MIDDLEWARE_CLASSES` and ``'django.contrib.sessions'`` 27 from your :setting:`INSTALLED_APPS`. It'll save you a small bit of overhead. 28 28 29 29 Configuring the session engine 30 30 ============================== … … 38 38 ------------------------------ 39 39 40 40 If you want to use a database-backed session, you need to add 41 ``'django.contrib.sessions'`` to your ``INSTALLED_APPS`` setting.41 ``'django.contrib.sessions'`` to your :setting:`INSTALLED_APPS` setting. 42 42 43 43 Once you have configured your installation, run ``manage.py syncdb`` 44 44 to install the single database table that stores session data. … … 86 86 Using file-based sessions 87 87 ------------------------- 88 88 89 To use file-based sessions, set the ``SESSION_ENGINE`` setting to89 To use file-based sessions, set the :setting:`SESSION_ENGINE` setting to 90 90 ``"django.contrib.sessions.backends.file"``. 91 91 92 You might also want to set the ``SESSION_FILE_PATH`` setting (which defaults92 You might also want to set the :setting:`SESSION_FILE_PATH` setting (which defaults 93 93 to output from ``tempfile.gettempdir()``, most likely ``/tmp``) to control 94 94 where Django stores session files. Be sure to check that your Web server has 95 95 permissions to read and write to this location. … … 346 346 347 347 request.session.modified = True 348 348 349 To change this default behavior, set the ``SESSION_SAVE_EVERY_REQUEST`` setting350 to ``True``. If ``SESSION_SAVE_EVERY_REQUEST`` is ``True``, Django will save349 To change this default behavior, set the :setting:`SESSION_SAVE_EVERY_REQUEST` setting 350 to ``True``. If :setting:`SESSION_SAVE_EVERY_REQUEST` is ``True``, Django will save 351 351 the session to the database on every single request. 352 352 353 353 Note that the session cookie is only sent when a session has been created or 354 modified. If ``SESSION_SAVE_EVERY_REQUEST`` is ``True``, the session cookie354 modified. If :setting:`SESSION_SAVE_EVERY_REQUEST` is ``True``, the session cookie 355 355 will be sent on every request. 356 356 357 357 Similarly, the ``expires`` part of a session cookie is updated each time the … … 361 361 =============================================== 362 362 363 363 You can control whether the session framework uses browser-length sessions vs. 364 persistent sessions with the ``SESSION_EXPIRE_AT_BROWSER_CLOSE`` setting.364 persistent sessions with the :setting:`SESSION_EXPIRE_AT_BROWSER_CLOSE` setting. 365 365 366 By default, ``SESSION_EXPIRE_AT_BROWSER_CLOSE`` is set to ``False``, which366 By default, :setting:`SESSION_EXPIRE_AT_BROWSER_CLOSE` is set to ``False``, which 367 367 means session cookies will be stored in users' browsers for as long as 368 ``SESSION_COOKIE_AGE``. Use this if you don't want people to have to log in368 :setting:`SESSION_COOKIE_AGE`. Use this if you don't want people to have to log in 369 369 every time they open a browser. 370 370 371 If ``SESSION_EXPIRE_AT_BROWSER_CLOSE`` is set to ``True``, Django will use371 If :setting:`SESSION_EXPIRE_AT_BROWSER_CLOSE` is set to ``True``, Django will use 372 372 browser-length cookies -- cookies that expire as soon as the user closes his or 373 373 her browser. Use this if you want people to have to log in every time they open 374 374 a browser. -
docs/topics/http/views.txt
48 48 49 49 .. admonition:: Django's Time Zone 50 50 51 Django includes a ``TIME_ZONE`` setting that defaults to51 Django includes a :setting:`TIME_ZONE` setting that defaults to 52 52 ``America/Chicago``. This probably isn't where you live, so you might want 53 53 to change it in your settings file. 54 54 -
docs/topics/cache.txt
420 420 entire site. You'll need to add 421 421 ``'django.middleware.cache.UpdateCacheMiddleware'`` and 422 422 ``'django.middleware.cache.FetchFromCacheMiddleware'`` to your 423 ``MIDDLEWARE_CLASSES`` setting, as in this example::423 :setting:`MIDDLEWARE_CLASSES` setting, as in this example:: 424 424 425 425 MIDDLEWARE_CLASSES = ( 426 426 'django.middleware.cache.UpdateCacheMiddleware', -
docs/topics/testing.txt
382 382 Aside from using a separate database, the test runner will otherwise 383 383 use all of the same database settings you have in your settings file: 384 384 :setting:`ENGINE`, :setting:`USER`, :setting:`HOST`, etc. The test 385 database is created by the user specified by ``USER``, so you'll need385 database is created by the user specified by :setting:`USER`, so you'll need 386 386 to make sure that the given user account has sufficient privileges to 387 387 create a new database on the system. 388 388 … … 1299 1299 ``django.test.TestCase`` provides the ability to customize the URLconf 1300 1300 configuration for the duration of the execution of a test suite. If your 1301 1301 ``TestCase`` instance defines an ``urls`` attribute, the ``TestCase`` will use 1302 the value of that attribute as the ``ROOT_URLCONF`` for the duration of that1302 the value of that attribute as the :setting:`ROOT_URLCONF` for the duration of that 1303 1303 test. 1304 1304 1305 1305 For example:: -
docs/topics/logging.txt
39 39 the severity of the messages that the logger will handle. Python 40 40 defines the following log levels: 41 41 42 * ``DEBUG``: Low level system information for debugging purposes42 * :setting:`DEBUG`: Low level system information for debugging purposes 43 43 44 44 * ``INFO``: General system information 45 45 … … 299 299 * Defines two formatters: 300 300 301 301 * ``simple``, that just outputs the log level name (e.g., 302 ``DEBUG``) and the log message.302 :setting:`DEBUG`) and the log message. 303 303 304 304 The `format` string is a normal Python formatting string 305 305 describing the details that are to be output on each logging … … 320 320 321 321 * Defines three handlers: 322 322 323 * ``null``, a NullHandler, which will pass any ``DEBUG`` or323 * ``null``, a NullHandler, which will pass any :setting:`DEBUG` or 324 324 higher message to ``/dev/null``. 325 325 326 * ``console``, a StreamHandler, which will print any ``DEBUG``326 * ``console``, a StreamHandler, which will print any :setting:`DEBUG` 327 327 message to stdout. This handler uses the `simple` output 328 328 format. 329 329 … … 450 450 451 451 Messages relating to the interaction of code with the database. 452 452 For example, every SQL statement executed by a request is logged 453 at the ``DEBUG`` level to this logger.453 at the :setting:`DEBUG` level to this logger. 454 454 455 455 Messages to this logger have the following extra context: 456 456 … … 486 486 The ``include_html`` argument of ``AdminEmailHandler`` is used to 487 487 control whether the traceback email includes an HTML attachment 488 488 containing the full content of the debug Web page that would have been 489 produced if ``DEBUG`` were ``True``. To set this value in your489 produced if :setting:`DEBUG` were ``True``. To set this value in your 490 490 configuration, include it in the handler definition for 491 491 ``django.utils.log.AdminEmailHandler``, like this:: 492 492 -
docs/topics/email.txt
509 509 ------------------------------- 510 510 511 511 If you need to change how emails are sent you can write your own email 512 backend. The ``EMAIL_BACKEND`` setting in your settings file is then the512 backend. The :setting:`EMAIL_BACKEND` setting in your settings file is then the 513 513 Python import path for your backend class. 514 514 515 515 Custom email backends should subclass ``BaseEmailBackend`` that is located in -
docs/topics/templates.txt
101 101 ``title`` attribute of the ``section`` object. 102 102 103 103 If you use a variable that doesn't exist, the template system will insert 104 the value of the ``TEMPLATE_STRING_IF_INVALID`` setting, which is set to ``''``104 the value of the :setting:`TEMPLATE_STRING_IF_INVALID` setting, which is set to ``''`` 105 105 (the empty string) by default. 106 106 107 107 Filters -
docs/topics/settings.txt
209 209 first positional argument) in the call to ``configure()``. 210 210 211 211 In this example, default settings are taken from ``myapp_defaults``, and the 212 ``DEBUG`` setting is set to ``True``, regardless of its value in212 :setting:`DEBUG` setting is set to ``True``, regardless of its value in 213 213 ``myapp_defaults``:: 214 214 215 215 from django.conf import settings -
docs/releases/1.3.txt
264 264 :ref:`running the Django test suite <running-unit-tests>` with ``runtests.py`` 265 265 when using :ref:`spatial database backends <spatial-backends>`. 266 266 267 ``MEDIA_URL`` and ``STATIC_URL`` must end in a slash267 :setting:`MEDIA_URL` and :setting:`STATIC_URL` must end in a slash 268 268 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 269 269 270 270 Previously, the :setting:`MEDIA_URL` setting only required a trailing slash if … … 580 580 581 581 * Now it is possible to override the translations shipped with applications by 582 582 using the :setting:`LOCALE_PATHS` setting whose translations have now higher 583 precedence than the translations of ``INSTALLED_APPS`` applications.583 precedence than the translations of :setting:`INSTALLED_APPS` applications. 584 584 The relative priority among the values listed in this setting has also been 585 585 modified so the paths listed first have higher precedence than the 586 586 ones listed later. … … 588 588 * The ``locale`` subdirectory of the directory containing the settings, that 589 589 usually coincides with and is know as the *project directory* is being 590 590 deprecated in this release as a source of translations. (the precedence of 591 these translations is intermediate between applications and ``LOCALE_PATHS``591 these translations is intermediate between applications and :setting:`LOCALE_PATHS` 592 592 translations). See the `corresponding deprecated features section`_ 593 593 of this document. 594 594 -
docs/releases/1.0-porting-guide.txt
443 443 Django fails to find the settings module and a :exc:`RuntimeError` when you try 444 444 to reconfigure settings after having already used them 445 445 446 ``LOGIN_URL`` has moved446 :setting:`LOGIN_URL` has moved 447 447 ~~~~~~~~~~~~~~~~~~~~~~~ 448 448 449 The ``LOGIN_URL`` constant moved from ``django.contrib.auth`` into the449 The :setting:`LOGIN_URL` constant moved from ``django.contrib.auth`` into the 450 450 ``settings`` module. Instead of using ``from django.contrib.auth import 451 451 LOGIN_URL`` refer to :setting:`settings.LOGIN_URL <LOGIN_URL>`. 452 452 … … 454 454 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 455 455 456 456 In 0.96, if a URL didn't end in a slash or have a period in the final 457 component of its path, and ``APPEND_SLASH`` was True, Django would redirect457 component of its path, and :setting:`APPEND_SLASH` was True, Django would redirect 458 458 to the same URL, but with a slash appended to the end. Now, Django checks to 459 459 see whether the pattern without the trailing slash would be matched by 460 460 something in your URL patterns. If so, no redirection takes place, because it … … 548 548 **Back up your database first!** 549 549 550 550 For SQLite, this means making a copy of the single file that stores the 551 database (the name of that file is the ``DATABASE_NAME`` in your settings.py551 database (the name of that file is the :setting:`DATABASE_NAME` in your settings.py 552 552 file). 553 553 554 554 To upgrade each application to use a ``DecimalField``, you can do the -
docs/releases/1.3-alpha-1.txt
249 249 prohibited words an empty list. 250 250 251 251 If you want to restore the old behavior, simply put a 252 ``PROFANITIES_LIST`` setting in your settings file that includes the252 :setting:`PROFANITIES_LIST` setting in your settings file that includes the 253 253 words that you want to prohibit (see the `commit that implemented this 254 254 change`_ if you want to see the list of words that was historically 255 255 prohibited). However, if avoiding profanities is important to you, you -
docs/releases/1.2.txt
1076 1076 to provide localizers the possibility to translate date and time formats. They 1077 1077 were translatable :term:`translation strings <translation string>` that could 1078 1078 be recognized because they were all upper case (for example 1079 ``DATETIME_FORMAT``, ``DATE_FORMAT``, ``TIME_FORMAT``). They have been1079 :setting:`DATETIME_FORMAT`, :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT`). They have been 1080 1080 deprecated in favor of the new :ref:`Format localization 1081 1081 <format-localization>` infrastructure that allows localizers to specify that 1082 1082 information in a ``formats.py`` file in the corresponding -
docs/faq/models.txt
6 6 How can I see the raw SQL queries Django is running? 7 7 ---------------------------------------------------- 8 8 9 Make sure your Django ``DEBUG`` setting is set to ``True``. Then, just do9 Make sure your Django :setting:`DEBUG` setting is set to ``True``. Then, just do 10 10 this:: 11 11 12 12 >>> from django.db import connection … … 14 14 [{'sql': 'SELECT polls_polls.id,polls_polls.question,polls_polls.pub_date FROM polls_polls', 15 15 'time': '0.002'}] 16 16 17 ``connection.queries`` is only available if ``DEBUG`` is ``True``. It's a list17 ``connection.queries`` is only available if :setting:`DEBUG` is ``True``. It's a list 18 18 of dictionaries in order of query execution. Each dictionary has the following:: 19 19 20 20 ``sql`` -- The raw SQL statement … … 89 89 90 90 Django isn't known to leak memory. If you find your Django processes are 91 91 allocating more and more memory, with no sign of releasing it, check to make 92 sure your ``DEBUG`` setting is set to ``False``. If ``DEBUG`` is ``True``, then92 sure your :setting:`DEBUG` setting is set to ``False``. If :setting:`DEBUG` is ``True``, then 93 93 Django saves a copy of every SQL statement it has executed. 94 94 95 95 (The queries are saved in ``django.db.connection.queries``. See 96 96 `How can I see the raw SQL queries Django is running?`_.) 97 97 98 To fix the problem, set ``DEBUG`` to ``False``.98 To fix the problem, set :setting:`DEBUG` to ``False``. 99 99 100 100 If you need to clear the query list manually at any point in your functions, 101 101 just call ``reset_queries()``, like this:: -
docs/faq/admin.txt
8 8 sent out by Django doesn't match the domain in your browser. Try these two 9 9 things: 10 10 11 * Set the ``SESSION_COOKIE_DOMAIN`` setting in your admin config file11 * Set the :setting:`SESSION_COOKIE_DOMAIN` setting in your admin config file 12 12 to match your domain. For example, if you're going to 13 13 "http://www.example.com/admin/" in your browser, in 14 14 "myproject.settings" you should set ``SESSION_COOKIE_DOMAIN = 'www.example.com'``. … … 17 17 don't have dots in them. If you're running the admin site on "localhost" 18 18 or another domain that doesn't have a dot in it, try going to 19 19 "localhost.localdomain" or "127.0.0.1". And set 20 ``SESSION_COOKIE_DOMAIN`` accordingly.20 :setting:`SESSION_COOKIE_DOMAIN` accordingly. 21 21 22 22 I can't log in. When I enter a valid username and password, it brings up the login page again, with a "Please enter a correct username and password" error. 23 23 ----------------------------------------------------------------------------------------------------------------------------------------------------------- -
docs/ref/generic-views.txt
58 58 just before rendering the template. 59 59 60 60 * ``mimetype``: The MIME type to use for the resulting document. Defaults 61 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.61 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 62 62 63 63 **Example:** 64 64 … … 198 198 the view's template. 199 199 200 200 * ``mimetype``: The MIME type to use for the resulting document. Defaults 201 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.201 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 202 202 203 203 * ``allow_future``: A boolean specifying whether to include "future" 204 204 objects on this page, where "future" means objects in which the field … … 290 290 this is ``False``. 291 291 292 292 * ``mimetype``: The MIME type to use for the resulting document. Defaults 293 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.293 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 294 294 295 295 * ``allow_future``: A boolean specifying whether to include "future" 296 296 objects on this page, where "future" means objects in which the field … … 377 377 determining the variable's name. 378 378 379 379 * ``mimetype``: The MIME type to use for the resulting document. Defaults 380 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.380 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 381 381 382 382 * ``allow_future``: A boolean specifying whether to include "future" 383 383 objects on this page, where "future" means objects in which the field … … 465 465 determining the variable's name. 466 466 467 467 * ``mimetype``: The MIME type to use for the resulting document. Defaults 468 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.468 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 469 469 470 470 * ``allow_future``: A boolean specifying whether to include "future" 471 471 objects on this page, where "future" means objects in which the field … … 550 550 determining the variable's name. 551 551 552 552 * ``mimetype``: The MIME type to use for the resulting document. Defaults 553 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.553 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 554 554 555 555 * ``allow_future``: A boolean specifying whether to include "future" 556 556 objects on this page, where "future" means objects in which the field … … 660 660 to use in the template context. By default, this is ``'object'``. 661 661 662 662 * ``mimetype``: The MIME type to use for the resulting document. Defaults 663 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.663 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 664 664 665 665 * ``allow_future``: A boolean specifying whether to include "future" 666 666 objects on this page, where "future" means objects in which the field … … 738 738 determining the variable's name. 739 739 740 740 * ``mimetype``: The MIME type to use for the resulting document. Defaults 741 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.741 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 742 742 743 743 **Template name:** 744 744 … … 852 852 to use in the template context. By default, this is ``'object'``. 853 853 854 854 * ``mimetype``: The MIME type to use for the resulting document. Defaults 855 to the value of the ``DEFAULT_CONTENT_TYPE`` setting.855 to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. 856 856 857 857 **Template name:** 858 858 -
docs/ref/forms/fields.txt
764 764 .. attribute:: URLField.validator_user_agent 765 765 766 766 String used as the user-agent used when checking for a URL's existence. 767 Defaults to the value of the ``URL_VALIDATOR_USER_AGENT`` setting.767 Defaults to the value of the :setting:`URL_VALIDATOR_USER_AGENT` setting. 768 768 769 769 .. versionchanged:: 1.2 770 770 The URLField previously did not recognize URLs as valid that contained an IDN -
docs/ref/templates/api.txt
462 462 If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every 463 463 ``RequestContext`` will contain these two variables: 464 464 465 * ``LANGUAGES`` -- The value of the :setting:`LANGUAGES` setting.466 * ``LANGUAGE_CODE`` -- ``request.LANGUAGE_CODE``, if it exists. Otherwise,465 * :setting:`LANGUAGES` -- The value of the :setting:`LANGUAGES` setting. 466 * :setting:`LANGUAGE_CODE` -- ``request.LANGUAGE_CODE``, if it exists. Otherwise, 467 467 the value of the :setting:`LANGUAGE_CODE` setting. 468 468 469 469 See :doc:`/topics/i18n/index` for more. … … 472 472 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 473 473 474 474 If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every 475 ``RequestContext`` will contain a variable ``MEDIA_URL``, providing the475 ``RequestContext`` will contain a variable :setting:`MEDIA_URL`, providing the 476 476 value of the :setting:`MEDIA_URL` setting. 477 477 478 478 django.core.context_processors.static … … 481 481 .. versionadded:: 1.3 482 482 483 483 If :setting:`TEMPLATE_CONTEXT_PROCESSORS` contains this processor, every 484 ``RequestContext`` will contain a variable ``STATIC_URL``, providing the484 ``RequestContext`` will contain a variable :setting:`STATIC_URL`, providing the 485 485 value of the :setting:`STATIC_URL` setting. 486 486 487 487 django.core.context_processors.csrf -
docs/ref/templates/builtins.txt
1305 1305 ``datetime.datetime.now()``), the output will be the string 1306 1306 ``'Wed 09 Jan 2008'``. 1307 1307 1308 The format passed can be one of the predefined ones ``DATE_FORMAT``,1309 ``DATETIME_FORMAT``, ``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a1308 The format passed can be one of the predefined ones :setting:`DATE_FORMAT`, 1309 :setting:`DATETIME_FORMAT`, :setting:`SHORT_DATE_FORMAT` or :setting:`SHORT_DATETIME_FORMAT`, or a 1310 1310 custom format that uses the format specifiers shown in the table above. Note 1311 1311 that predefined formats may vary depending on the current locale. 1312 1312 … … 1939 1939 1940 1940 Formats a time according to the given format. 1941 1941 1942 Given format can be the predefined one ``TIME_FORMAT``, or a custom format,1942 Given format can be the predefined one :setting:`TIME_FORMAT`, or a custom format, 1943 1943 same as the :tfilter:`date` filter. Note that the predefined format is locale- 1944 1944 dependant. 1945 1945 … … 2241 2241 ------------------------------- 2242 2242 2243 2243 Django comes with a couple of other template-tag libraries that you have to 2244 enable explicitly in your ``INSTALLED_APPS`` setting and enable in your2244 enable explicitly in your :setting:`INSTALLED_APPS` setting and enable in your 2245 2245 template with the ``{% load %}`` tag. 2246 2246 2247 2247 django.contrib.humanize … … 2272 2272 2273 2273 Provides a couple of templatetags that allow specifying translatable text in 2274 2274 Django templates. It is slightly different from the libraries described 2275 above because you don't need to add any application to the ``INSTALLED_APPS``2275 above because you don't need to add any application to the :setting:`INSTALLED_APPS` 2276 2276 setting but rather set :setting:`USE_I18N` to True, then loading it with 2277 2277 ``{% load i18n %}``. See :ref:`specifying-translation-strings-in-template-code`. 2278 2278 … … 2281 2281 2282 2282 Provides a couple of templatetags that allow control over the localization of 2283 2283 values in Django templates. It is slightly different from the libraries described 2284 above because you don't need to add any application to the ``INSTALLED_APPS``;2284 above because you don't need to add any application to the :setting:`INSTALLED_APPS`; 2285 2285 you only need to load the library using ``{% load l10n %}``. See 2286 2286 :ref:`topic-l10n-templates`. -
docs/ref/contrib/gis/geoip.txt
18 18 datasets in binary format (the CSV files will not work!). These datasets may be 19 19 `downloaded from MaxMind`__. Grab the ``GeoIP.dat.gz`` and ``GeoLiteCity.dat.gz`` 20 20 and unzip them in a directory corresponding to what you set 21 ``GEOIP_PATH`` with in your settings. See the example and reference below21 :setting:`GEOIP_PATH` with in your settings. See the example and reference below 22 22 for more details. 23 23 24 24 __ http://www.maxmind.com/app/c -
docs/ref/contrib/gis/install.txt
180 180 181 181 .. _geoslibrarypath: 182 182 183 ``GEOS_LIBRARY_PATH``183 :setting:`GEOS_LIBRARY_PATH` 184 184 ~~~~~~~~~~~~~~~~~~~~~ 185 185 186 186 If your GEOS library is in a non-standard location, or you don't want to … … 318 318 319 319 .. _gdallibrarypath: 320 320 321 ``GDAL_LIBRARY_PATH``321 :setting:`GDAL_LIBRARY_PATH` 322 322 ~~~~~~~~~~~~~~~~~~~~~ 323 323 324 324 If your GDAL library is in a non-standard location, or you don't want to … … 592 592 __ http://www.gaia-gis.it/spatialite/resources.html 593 593 594 594 595 Add ``django.contrib.gis`` to ``INSTALLED_APPS``595 Add ``django.contrib.gis`` to :setting:`INSTALLED_APPS` 596 596 ------------------------------------------------ 597 597 598 598 Like other Django contrib applications, you will *only* need to add -
docs/ref/contrib/gis/testing.txt
25 25 26 26 .. setting:: POSTGIS_TEMPLATE 27 27 28 ``POSTGIS_TEMPLATE``28 :setting:`POSTGIS_TEMPLATE` 29 29 ^^^^^^^^^^^^^^^^^^^^ 30 30 31 31 .. versionchanged:: 1.2 … … 37 37 38 38 .. setting:: POSTGIS_VERSION 39 39 40 ``POSTGIS_VERSION``40 :setting:`POSTGIS_VERSION` 41 41 ^^^^^^^^^^^^^^^^^^^ 42 42 43 43 When GeoDjango's spatial backend initializes on PostGIS, it has to perform … … 129 129 130 130 .. setting:: SPATIALITE_SQL 131 131 132 ``SPATIALITE_SQL``132 :setting:`SPATIALITE_SQL` 133 133 ^^^^^^^^^^^^^^^^^^ 134 134 135 135 By default, the GeoDjango test runner looks for the SpatiaLite SQL in the -
docs/ref/contrib/index.txt
14 14 15 15 For most of these add-ons -- specifically, the add-ons that include either 16 16 models or template tags -- you'll need to add the package name (e.g., 17 ``'django.contrib.admin'``) to your ``INSTALLED_APPS`` setting and re-run17 ``'django.contrib.admin'``) to your :setting:`INSTALLED_APPS` setting and re-run 18 18 ``manage.py syncdb``. 19 19 20 20 .. _"batteries included" philosophy: http://docs.python.org/tutorial/stdlib.html#batteries-included -
docs/ref/contrib/messages.txt
101 101 =========== ======== 102 102 Constant Purpose 103 103 =========== ======== 104 ``DEBUG`` Development-related messages that will be ignored (or removed) in a production deployment104 :setting:`DEBUG` Development-related messages that will be ignored (or removed) in a production deployment 105 105 ``INFO`` Informational messages for the user 106 106 ``SUCCESS`` An action was successful, e.g. "Your profile was updated successfully" 107 107 ``WARNING`` A failure did not occur but may be imminent … … 128 128 ============== =========== 129 129 Level Constant Tag 130 130 ============== =========== 131 ``DEBUG`` ``debug``131 :setting:`DEBUG` ``debug`` 132 132 ``INFO`` ``info`` 133 133 ``SUCCESS`` ``success`` 134 134 ``WARNING`` ``warning`` … … 202 202 ============== ===== 203 203 Level Constant Value 204 204 ============== ===== 205 ``DEBUG`` 10205 :setting:`DEBUG` 10 206 206 ``INFO`` 20 207 207 ``SUCCESS`` 25 208 208 ``WARNING`` 30 … … 386 386 Default: ``None`` 387 387 388 388 The storage backends that use cookies -- ``CookieStorage`` and 389 ``FallbackStorage`` -- use the value of ``SESSION_COOKIE_DOMAIN`` in389 ``FallbackStorage`` -- use the value of :setting:`SESSION_COOKIE_DOMAIN` in 390 390 setting their cookies. See the :doc:`settings documentation </ref/settings>` 391 391 for more information on how this works and why you might need to set it. 392 392 -
docs/ref/contrib/admin/index.txt
1745 1745 ) 1746 1746 1747 1747 Above we used ``admin.autodiscover()`` to automatically load the 1748 ``INSTALLED_APPS`` admin.py modules.1748 :setting:`INSTALLED_APPS` admin.py modules. 1749 1749 1750 1750 In this example, we register the ``AdminSite`` instance 1751 1751 ``myproject.admin.admin_site`` at the URL ``/myadmin/`` :: -
docs/ref/databases.txt
262 262 :setting:`HOST`, :setting:`PORT` 263 263 3. MySQL option files. 264 264 265 In other words, if you set the name of the database in ``OPTIONS``,266 this will take precedence over ``NAME``, which would override265 In other words, if you set the name of the database in :setting:`OPTIONS`, 266 this will take precedence over :setting:`NAME`, which would override 267 267 anything in a `MySQL option file`_. 268 268 269 269 Here's a sample configuration which uses a MySQL option file:: … … 574 574 575 575 If you don't use a ``tnsnames.ora`` file or a similar naming method that 576 576 recognizes the SID ("xe" in this example), then fill in both 577 ``HOST`` and ``PORT`` like so::577 :setting:`HOST` and :setting:`PORT` like so:: 578 578 579 579 DATABASES = { 580 580 'default': { … … 587 587 } 588 588 } 589 589 590 You should supply both ``HOST`` and ``PORT``, or leave both590 You should supply both :setting:`HOST` and :setting:`PORT`, or leave both 591 591 as empty strings. 592 592 593 593 Threaded option -
docs/ref/django-admin.txt
57 57 --------- 58 58 59 59 Many commands take a list of "app names." An "app name" is the basename of 60 the package containing your models. For example, if your ``INSTALLED_APPS``60 the package containing your models. For example, if your :setting:`INSTALLED_APPS` 61 61 contains the string ``'mysite.blog'``, the app name is ``blog``. 62 62 63 63 Determining the version … … 126 126 127 127 Runs the command-line client for the database engine specified in your 128 128 ``ENGINE`` setting, with the connection parameters specified in your 129 ``USER``, ``PASSWORD``, etc., settings.129 :setting:`USER`, :setting:`PASSWORD`, etc., settings. 130 130 131 131 * For PostgreSQL, this runs the ``psql`` command-line client. 132 132 * For MySQL, this runs the ``mysql`` command-line client. … … 151 151 settings. 152 152 153 153 Settings that don't appear in the defaults are followed by ``"###"``. For 154 example, the default settings don't define ``ROOT_URLCONF``, so155 ``ROOT_URLCONF`` is followed by ``"###"`` in the output of ``diffsettings``.154 example, the default settings don't define :setting:`ROOT_URLCONF`, so 155 :setting:`ROOT_URLCONF` is followed by ``"###"`` in the output of ``diffsettings``. 156 156 157 157 Note that Django's default settings live in ``django/conf/global_settings.py``, 158 158 if you're ever curious to see the full list of defaults. … … 245 245 .. django-admin:: inspectdb 246 246 247 247 Introspects the database tables in the database pointed-to by the 248 ``NAME`` setting and outputs a Django model module (a ``models.py``248 :setting:`NAME` setting and outputs a Django model module (a ``models.py`` 249 249 file) to standard output. 250 250 251 251 Use this if you have a legacy database with which you'd like to use Django. … … 309 309 Django will search in three locations for fixtures: 310 310 311 311 1. In the ``fixtures`` directory of every installed application 312 2. In any directory named in the ``FIXTURE_DIRS`` setting312 2. In any directory named in the :setting:`FIXTURE_DIRS` setting 313 313 3. In the literal path named by the fixture 314 314 315 315 Django will load any and all fixtures it finds in these locations that match … … 340 340 341 341 would search ``<appname>/fixtures/foo/bar/mydata.json`` for each installed 342 342 application, ``<dirname>/foo/bar/mydata.json`` for each directory in 343 ``FIXTURE_DIRS``, and the literal path ``foo/bar/mydata.json``.343 :setting:`FIXTURE_DIRS`, and the literal path ``foo/bar/mydata.json``. 344 344 345 345 When fixture files are processed, the data is saved to the database as is. 346 346 Model defined ``save`` methods and ``pre_save`` signals are not called. … … 742 742 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 743 743 744 744 By default, the development server doesn't serve any static files for your site 745 (such as CSS files, images, things under ``MEDIA_URL`` and so forth). If745 (such as CSS files, images, things under :setting:`MEDIA_URL` and so forth). If 746 746 you want to configure Django to serve static media, read :doc:`/howto/static-files`. 747 747 748 748 shell … … 912 912 913 913 .. django-admin:: syncdb 914 914 915 Creates the database tables for all apps in ``INSTALLED_APPS`` whose tables915 Creates the database tables for all apps in :setting:`INSTALLED_APPS` whose tables 916 916 have not already been created. 917 917 918 918 Use this command when you've added new applications to your project and want to 919 919 install them in the database. This includes any apps shipped with Django that 920 might be in ``INSTALLED_APPS`` by default. When you start a new project, run920 might be in :setting:`INSTALLED_APPS` by default. When you start a new project, run 921 921 this command to install the default apps. 922 922 923 923 .. admonition:: Syncdb will not alter existing tables … … 1032 1032 1033 1033 .. django-admin:: validate 1034 1034 1035 Validates all installed models (according to the ``INSTALLED_APPS`` setting)1035 Validates all installed models (according to the :setting:`INSTALLED_APPS` setting) 1036 1036 and prints validation errors to standard output. 1037 1037 1038 1038 Commands provided by applications -
docs/ref/settings.txt
86 86 tag. This is a security measure, so that template authors can't access files 87 87 that they shouldn't be accessing. 88 88 89 For example, if ``ALLOWED_INCLUDE_ROOTS`` is ``('/home/html', '/var/www')``,89 For example, if :setting:`ALLOWED_INCLUDE_ROOTS` is ``('/home/html', '/var/www')``, 90 90 then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}`` 91 91 wouldn't. 92 92 … … 102 102 same URL with a slash appended. Note that the redirect may cause any data 103 103 submitted in a POST request to be lost. 104 104 105 The ``APPEND_SLASH`` setting is only used if105 The :setting:`APPEND_SLASH` setting is only used if 106 106 :class:`~django.middleware.common.CommonMiddleware` is installed 107 107 (see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`. 108 108 … … 601 601 :tfilter:`allowed date format strings <date>`. 602 602 603 603 .. versionchanged:: 1.2 604 This setting can now be overriden by setting ``USE_L10N`` to ``True``.604 This setting can now be overriden by setting :setting:`USE_L10N` to ``True``. 605 605 606 See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.606 See also :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATE_FORMAT`. 607 607 608 608 .. setting:: DATE_INPUT_FORMATS 609 609 … … 624 624 syntax, that is different from the one used by Django for formatting dates 625 625 to be displayed. 626 626 627 See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.627 See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`. 628 628 629 629 .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior 630 630 … … 641 641 :tfilter:`allowed date format strings <date>`. 642 642 643 643 .. versionchanged:: 1.2 644 This setting can now be overriden by setting ``USE_L10N`` to ``True``.644 This setting can now be overriden by setting :setting:`USE_L10N` to ``True``. 645 645 646 See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.646 See also :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`. 647 647 648 648 .. setting:: DATETIME_INPUT_FORMATS 649 649 … … 664 664 syntax, that is different from the one used by Django for formatting dates 665 665 to be displayed. 666 666 667 See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.667 See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`. 668 668 669 669 .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior 670 670 … … 687 687 are inappropriate for public consumption. File paths, configuration options, and 688 688 the like all give attackers extra information about your server. 689 689 690 It is also important to remember that when running with ``DEBUG`` turned on, Django690 It is also important to remember that when running with :setting:`DEBUG` turned on, Django 691 691 will remember every SQL query it executes. This is useful when you are debugging, 692 692 but on a production server, it will rapidly consume memory. 693 693 694 Never deploy a site into production with ``DEBUG`` turned on.694 Never deploy a site into production with :setting:`DEBUG` turned on. 695 695 696 696 .. _django/views/debug.py: http://code.djangoproject.com/browser/django/trunk/django/views/debug.py 697 697 … … 724 724 Default: ``'utf-8'`` 725 725 726 726 Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't 727 manually specified. Used with ``DEFAULT_CONTENT_TYPE`` to construct the727 manually specified. Used with :setting:`DEFAULT_CONTENT_TYPE` to construct the 728 728 ``Content-Type`` header. 729 729 730 730 .. setting:: DEFAULT_CONTENT_TYPE … … 735 735 Default: ``'text/html'`` 736 736 737 737 Default content type to use for all ``HttpResponse`` objects, if a MIME type 738 isn't manually specified. Used with ``DEFAULT_CHARSET`` to construct the738 isn't manually specified. Used with :setting:`DEFAULT_CHARSET` to construct the 739 739 ``Content-Type`` header. 740 740 741 741 .. setting:: DEFAULT_FILE_STORAGE … … 822 822 823 823 The host to use for sending email. 824 824 825 See also ``EMAIL_PORT``.825 See also :setting:`EMAIL_PORT`. 826 826 827 827 .. setting:: EMAIL_HOST_PASSWORD 828 828 … … 831 831 832 832 Default: ``''`` (Empty string) 833 833 834 Password to use for the SMTP server defined in ``EMAIL_HOST``. This setting is835 used in conjunction with ``EMAIL_HOST_USER`` when authenticating to the SMTP834 Password to use for the SMTP server defined in :setting:`EMAIL_HOST`. This setting is 835 used in conjunction with :setting:`EMAIL_HOST_USER` when authenticating to the SMTP 836 836 server. If either of these settings is empty, Django won't attempt 837 837 authentication. 838 838 839 See also ``EMAIL_HOST_USER``.839 See also :setting:`EMAIL_HOST_USER`. 840 840 841 841 .. setting:: EMAIL_HOST_USER 842 842 … … 845 845 846 846 Default: ``''`` (Empty string) 847 847 848 Username to use for the SMTP server defined in ``EMAIL_HOST``. If empty,848 Username to use for the SMTP server defined in :setting:`EMAIL_HOST`. If empty, 849 849 Django won't attempt authentication. 850 850 851 See also ``EMAIL_HOST_PASSWORD``.851 See also :setting:`EMAIL_HOST_PASSWORD`. 852 852 853 853 .. setting:: EMAIL_PORT 854 854 … … 857 857 858 858 Default: ``25`` 859 859 860 Port to use for the SMTP server defined in ``EMAIL_HOST``.860 Port to use for the SMTP server defined in :setting:`EMAIL_HOST`. 861 861 862 862 .. setting:: EMAIL_SUBJECT_PREFIX 863 863 … … 1004 1004 file, under the directory named as the current locale, and will use the 1005 1005 formats defined on this file. 1006 1006 1007 For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and1007 For example, if :setting:`FORMAT_MODULE_PATH` is set to ``mysite.formats``, and 1008 1008 current language is ``en`` (English), Django will expect a directory tree 1009 1009 like:: 1010 1010 … … 1015 1015 __init__.py 1016 1016 formats.py 1017 1017 1018 Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,1019 ``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,1020 ``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,1021 ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.1018 Available formats are :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT`, :setting:`DATETIME_FORMAT`, 1019 :setting:`YEAR_MONTH_FORMAT`, :setting:`MONTH_DAY_FORMAT`, :setting:`SHORT_DATE_FORMAT`, 1020 :setting:`SHORT_DATETIME_FORMAT`, :setting:`FIRST_DAY_OF_WEEK`, :setting:`DECIMAL_SEPARATOR`, 1021 :setting:`THOUSAND_SEPARATOR` and :setting:`NUMBER_GROUPING`. 1022 1022 1023 1023 .. setting:: IGNORABLE_404_URLS 1024 1024 … … 1067 1067 1068 1068 A tuple of IP addresses, as strings, that: 1069 1069 1070 * See debug comments, when ``DEBUG`` is ``True``1070 * See debug comments, when :setting:`DEBUG` is ``True`` 1071 1071 * Receive X headers if the ``XViewMiddleware`` is installed (see 1072 1072 :doc:`/topics/http/middleware`) 1073 1073 … … 1090 1090 Default: ``'django_language'`` 1091 1091 1092 1092 The name of the cookie to use for the language cookie. This can be whatever you 1093 want (but should be different from ``SESSION_COOKIE_NAME``). See1093 want (but should be different from :setting:`SESSION_COOKIE_NAME`). See 1094 1094 :doc:`/topics/i18n/index`. 1095 1095 1096 1096 .. setting:: LANGUAGES … … 1114 1114 Generally, the default value should suffice. Only set this setting if you want 1115 1115 to restrict language selection to a subset of the Django-provided languages. 1116 1116 1117 If you define a custom ``LANGUAGES`` setting, it's OK to mark the languages as1117 If you define a custom :setting:`LANGUAGES` setting, it's OK to mark the languages as 1118 1118 translation strings (as in the default value referred to above) -- but use a 1119 1119 "dummy" ``gettext()`` function, not the one in ``django.utils.translation``. 1120 1120 You should *never* import ``django.utils.translation`` from within your … … 1134 1134 With this arrangement, ``django-admin.py makemessages`` will still find and 1135 1135 mark these strings for translation, but the translation won't happen at 1136 1136 runtime -- so you'll have to remember to wrap the languages in the *real* 1137 ``gettext()`` in any code that uses ``LANGUAGES`` at runtime.1137 ``gettext()`` in any code that uses :setting:`LANGUAGES` at runtime. 1138 1138 1139 1139 .. setting:: LOCALE_PATHS 1140 1140 … … 1230 1230 1231 1231 Default: ``()`` (Empty tuple) 1232 1232 1233 A tuple in the same format as ``ADMINS`` that specifies who should get1233 A tuple in the same format as :setting:`ADMINS` that specifies who should get 1234 1234 broken-link notifications when ``SEND_BROKEN_LINK_EMAILS=True``. 1235 1235 1236 1236 .. setting:: MEDIA_ROOT … … 1335 1335 locales have different formats. For example, U.S. English would say 1336 1336 "January 1," whereas Spanish might say "1 Enero." 1337 1337 1338 See :tfilter:`allowed date format strings <date>`. See also ``DATE_FORMAT``,1339 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.1338 See :tfilter:`allowed date format strings <date>`. See also :setting:`DATE_FORMAT`, 1339 :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`YEAR_MONTH_FORMAT`. 1340 1340 1341 1341 .. setting:: NUMBER_GROUPING 1342 1342 … … 1430 1430 1431 1431 Default: ``False`` 1432 1432 1433 Whether to send an email to the ``MANAGERS`` each time somebody visits a1433 Whether to send an email to the :setting:`MANAGERS` each time somebody visits a 1434 1434 Django-powered page that is 404ed with a non-empty referer (i.e., a broken 1435 1435 link). This is only used if ``CommonMiddleware`` is installed (see 1436 :doc:`/topics/http/middleware`). See also ``IGNORABLE_404_URLS`` and1436 :doc:`/topics/http/middleware`). See also :setting:`IGNORABLE_404_URLS` and 1437 1437 :doc:`/howto/error-reporting`. 1438 1438 1439 1439 .. setting:: SERIALIZATION_MODULES … … 1457 1457 Default: ``'root@localhost'`` 1458 1458 1459 1459 The email address that error messages come from, such as those sent to 1460 ``ADMINS`` and ``MANAGERS``.1460 :setting:`ADMINS` and :setting:`MANAGERS`. 1461 1461 1462 1462 .. setting:: SESSION_COOKIE_AGE 1463 1463 … … 1506 1506 Default: ``'sessionid'`` 1507 1507 1508 1508 The name of the cookie to use for sessions. This can be whatever you want (but 1509 should be different from ``LANGUAGE_COOKIE_NAME``). See the :doc:`/topics/http/sessions`.1509 should be different from :setting:`LANGUAGE_COOKIE_NAME`). See the :doc:`/topics/http/sessions`. 1510 1510 1511 1511 .. setting:: SESSION_COOKIE_PATH 1512 1512 … … 1596 1596 corresponding locale-dictated format has higher precedence and will be applied. 1597 1597 See :tfilter:`allowed date format strings <date>`. 1598 1598 1599 See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.1599 See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`. 1600 1600 1601 1601 .. setting:: SHORT_DATETIME_FORMAT 1602 1602 … … 1612 1612 corresponding locale-dictated format has higher precedence and will be applied. 1613 1613 See :tfilter:`allowed date format strings <date>`. 1614 1614 1615 See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.1615 See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`. 1616 1616 1617 1617 .. setting:: SITE_ID 1618 1618 … … 1721 1721 report contains the relevant snippet of the template, with the appropriate line 1722 1722 highlighted. 1723 1723 1724 Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so1724 Note that Django only displays fancy error pages if :setting:`DEBUG` is ``True``, so 1725 1725 you'll want to set that to take advantage of this setting. 1726 1726 1727 See also ``DEBUG``.1727 See also :setting:`DEBUG`. 1728 1728 1729 1729 .. setting:: TEMPLATE_DIRS 1730 1730 … … 1756 1756 1757 1757 .. versionchanged:: 1.2 1758 1758 The class-based API for template loaders was introduced in Django 1.2 1759 although the ``TEMPLATE_LOADERS`` setting will accept strings that specify1759 although the :setting:`TEMPLATE_LOADERS` setting will accept strings that specify 1760 1760 function-based loaders until compatibility with them is completely removed in 1761 1761 Django 1.4. 1762 1762 … … 1795 1795 Default ``,`` (Comma) 1796 1796 1797 1797 Default thousand separator used when formatting numbers. This setting is 1798 used only when ``NUMBER_GROUPING`` and ``USE_THOUSAND_SEPARATOR`` are set.1798 used only when :setting:`NUMBER_GROUPING` and :setting:`USE_THOUSAND_SEPARATOR` are set. 1799 1799 1800 1800 See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and 1801 1801 :setting:`USE_THOUSAND_SEPARATOR`. … … 1813 1813 :tfilter:`allowed date format strings <date>`. 1814 1814 1815 1815 .. versionchanged:: 1.2 1816 This setting can now be overriden by setting ``USE_L10N`` to ``True``.1816 This setting can now be overriden by setting :setting:`USE_L10N` to ``True``. 1817 1817 1818 See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.1818 See also :setting:`DATE_FORMAT` and :setting:`DATETIME_FORMAT`. 1819 1819 1820 1820 .. setting:: TIME_INPUT_FORMATS 1821 1821 … … 1832 1832 syntax, that is different from the one used by Django for formatting dates 1833 1833 to be displayed. 1834 1834 1835 See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.1835 See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`. 1836 1836 1837 1837 .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior 1838 1838 … … 1851 1851 choices lists more than one on the same line; you'll want to use just 1852 1852 one of the choices for a given time zone. For instance, one line says 1853 1853 ``'Europe/London GB GB-Eire'``, but you should use the first bit of 1854 that -- ``'Europe/London'`` -- as your ``TIME_ZONE`` setting.)1854 that -- ``'Europe/London'`` -- as your :setting:`TIME_ZONE` setting.) 1855 1855 1856 1856 Note that this is the time zone to which Django will convert all 1857 1857 dates/times -- not necessarily the timezone of the server. For … … 1859 1859 a separate time-zone setting. 1860 1860 1861 1861 Normally, Django sets the ``os.environ['TZ']`` variable to the time 1862 zone you specify in the ``TIME_ZONE`` setting. Thus, all your views1862 zone you specify in the :setting:`TIME_ZONE` setting. Thus, all your views 1863 1863 and models will automatically operate in the correct time zone. 1864 1864 However, Django won't set the ``TZ`` environment variable under the 1865 1865 following conditions: … … 1916 1916 set to ``False``, Django will make some optimizations so as not to load the 1917 1917 internationalization machinery. 1918 1918 1919 See also ``USE_L10N``1919 See also :setting:`USE_L10N` 1920 1920 1921 1921 .. setting:: USE_L10N 1922 1922 … … 1931 1931 is set to ``True``, e.g. Django will display numbers and dates using the 1932 1932 format of the current locale. 1933 1933 1934 See also ``USE_I18N`` and ``LANGUAGE_CODE``1934 See also :setting:`USE_I18N` and :setting:`LANGUAGE_CODE` 1935 1935 1936 1936 .. setting:: USE_THOUSAND_SEPARATOR 1937 1937 … … 1943 1943 Default ``False`` 1944 1944 1945 1945 A boolean that specifies wheter to display numbers using a thousand separator. 1946 If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``1947 and ``NUMBER_GROUPING`` from current locale, to format the number.1948 ``USE_L10N`` must be set to ``True``, in order to format numbers.1946 If this is set to ``True``, Django will use values from :setting:`THOUSAND_SEPARATOR` 1947 and :setting:`NUMBER_GROUPING` from current locale, to format the number. 1948 :setting:`USE_L10N` must be set to ``True``, in order to format numbers. 1949 1949 1950 See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.1950 See also :setting:`THOUSAND_SEPARATOR` and :setting:`NUMBER_GROUPING`. 1951 1951 1952 1952 .. setting:: YEAR_MONTH_FORMAT 1953 1953 … … 1965 1965 Different locales have different formats. For example, U.S. English would say 1966 1966 "January 2006," whereas another locale might say "2006/January." 1967 1967 1968 See :tfilter:`allowed date format strings <date>`. See also ``DATE_FORMAT``,1969 ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``MONTH_DAY_FORMAT``.1968 See :tfilter:`allowed date format strings <date>`. See also :setting:`DATE_FORMAT`, 1969 :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`MONTH_DAY_FORMAT`. 1970 1970 1971 1971 Deprecated settings 1972 1972 =================== -
docs/ref/utils.txt
61 61 62 62 Each header is only added if it isn't already set. 63 63 64 ``cache_timeout`` is in seconds. The ``CACHE_MIDDLEWARE_SECONDS`` setting64 ``cache_timeout`` is in seconds. The :setting:`CACHE_MIDDLEWARE_SECONDS` setting 65 65 is used by default. 66 66 67 67 .. function:: add_never_cache_headers(response)