ID |
English原文 |
中文翻译 |
最近翻译记录 |
状态 |
操作 |
0#翻译 |
Appendix E: Settings
--------------------
|
附录E 配置参考
-------------------- |
1482天前 |
|
翻译 |
1#翻译 |
Your Django settings file contains all the configuration of your Django installation. This
appendix explains how settings work and which settings are available.
|
你的 Django 设置文件包含了所有的 Django 安装配置。本附录解释了如何设置去使它工作以及哪些设置是有效的。
|
1425天前 |
|
翻译 |
2#翻译 |
Note
|
注意
|
1425天前 |
|
翻译 |
3#翻译 |
As Django grows, its occasionally necessary to add or (rarely) change settings. You should
always check the online settings documentation at
`http://www.djangoproject.com/documentation/0.96/settings/`_ for the latest information.
|
随着Django的发展,它有时候需要添加或改变(很少)一些settings ,你应该经常去查看在线的settings 文档( `http://www.djangoproject.com/documentation/0.96/settings/`_ ),了解最新的信息。 |
1196天前 |
|
翻译 |
4#翻译 |
Whats a Settings File?
``````````````````````
|
什么是settings文件
``````````````````````
|
435天前 |
|
翻译 |
5#翻译 |
A *settings file* is just a Python module with module-level variables.
|
一个 *settings 文件* 只是一个有一些模块级变量的Python模块。 |
1270天前 |
|
翻译 |
6#翻译 |
Here are a couple of example settings:
|
这里是一些settings例子: |
1197天前 |
|
翻译 |
9#翻译 |
Because a settings file is a Python module, the following apply:
|
因为一个settings 文件是一个python模块,必须符合下面的一些的规则: |
1270天前 |
|
翻译 |
10#翻译 |
It must be valid Python code; syntax errors arent allowed.
|
它必须是合法的python代码,不允许语法错误。 |
1270天前 |
|
翻译 |
11#翻译 |
It can assign settings dynamically using normal Python syntax, for example:
|
可以通过正常的python语法给settings动态赋值,比如: |
1270天前 |
|
翻译 |
14#翻译 |
It can import values from other settings files.
|
它可以从其他settings 文件导入值。 |
1270天前 |
|
翻译 |
15#翻译 |
Default Settings
''''''''''''''''
|
默认Settings
''''''''''''''''
|
1418天前 |
|
翻译 |
16#翻译 |
A Django settings file doesnt have to define any settings if it doesnt need to. Each setting has
a sensible default value. These defaults live in the file ``django/conf/global_settings.py`` .
|
一个django Settings可以为空,如果你不需要的话。每一个Settings有一个切合实际的默认值,这些默认值值在文件 ``django/conf/global_settings.py`` 里。 |
1270天前 |
|
翻译 |
17#翻译 |
Heres the algorithm Django uses in compiling settings:
|
下面是django在编译settings文件时运用的规则: |
1418天前 |
|
翻译 |
18#翻译 |
* Load settings from ``global_settings.py`` .
|
* 从 ``global_settings.py`` 装载settings .
|
1418天前 |
|
翻译 |
19#翻译 |
* Load settings from the specified settings file, overriding the global settings as necessary.
|
* 从指定settings 文件装载settings , 在需要的时候,覆盖全局的settings |
1418天前 |
|
翻译 |
20#翻译 |
Note that a settings file should *not* import from ``global_settings`` , because thats
redundant.
|
注意一个settings 文件不应该导入 ``global_settings`` ,因为那是多余(冗余)的。 |
1270天前 |
|
翻译 |
21#翻译 |
Seeing Which Settings Youve Changed
'''''''''''''''''''''''''''''''''''
|
查看你已经改变了哪些Settings
'''''''''''''''''''''''''''''''''''
|
1270天前 |
|
翻译 |
22#翻译 |
Theres an easy way to view which of your settings deviate from the default settings. The command
``manage.py diffsettings`` displays differences between the current settings file and Djangos
default settings.
|
有一个容易的方法来查看你的哪些Settings 和默认的Settings 不同,命令行 ``manage.py diffsettings`` 可以显示当前的settings 文件文件和默认的settings 的不同之处。 |
1270天前 |
|
翻译 |
23#翻译 |
``manage.py`` is described in more detail in Appendix G.
|
``manage.py`` 的更详细描述在附录G, |
1270天前 |
|
翻译 |
24#翻译 |
Using Settings in Python Code
'''''''''''''''''''''''''''''
|
在Python代码中使Settings
'''''''''''''''''''''''''''''
|
1270天前 |
|
翻译 |
25#翻译 |
In your Django applications, use settings by importing the object ``django.conf.settings`` , for
example:
|
在你的Django应用程序中,从对象 ``django.conf.settings`` 导入settings使用,例如: |
1270天前 |
|
翻译 |
28#翻译 |
Note that ``django.conf.settings`` isnt a module its an object. So importing individual settings
is not possible:
|
注意 ``django.conf.settings`` 不是一个模块,而是一个对象。所以不能单独导入settings: |
1270天前 |
|
翻译 |
31#翻译 |
Also note that your code should *not* import from either ``global_settings`` or your own
settings file. ``django.conf.settings`` abstracts the concepts of default settings and
site-specific settings; it presents a single interface. It also decouples the code that uses
settings from the location of your settings.
|
同样要注意,你的代码中 *不* 应该导入 ``global_settings`` 或者自己的settings文件。 ``django.conf.settings`` 抽象了默认的设置和每个站点的设置;它提供了一个单一的接口。并且,它也使得你所写的代码与你的设置文件的位置没有耦合。 |
1270天前 |
|
翻译 |
32#翻译 |
Altering Settings at Runtime
''''''''''''''''''''''''''''
|
运行期间修改Settings
''''''''''''''''''''
|
1196天前 |
|
翻译 |
33#翻译 |
You shouldnt alter settings in your applications at runtime. For example, dont do this in a
view:
|
你不应该在你的应用程序运行期间修改设置, 例如, 不要在view里面做这样的事情: |
1319天前 |
|
翻译 |
36#翻译 |
The only place you should assign to ``settings`` is in a settings file.
|
settings文件应该是唯一个修改 ``settings`` 的地方. |
1258天前 |
|
翻译 |
37#翻译 |
Security
''''''''
|
安全 |
1306天前 |
|
翻译 |
38#翻译 |
Because a settings file contains sensitive information, such as the database password, you
should make every attempt to limit access to it. For example, change its file permissions so
that only you and your Web servers user can read it. This is especially important in a
shared-hosting environment.
|
因为settings文件包含敏感信息,例如数据库密码,你应该尝试限制访问它.例如,改变它的文件权限使得只有你和你的Web服务器用户帐号才能读取它.这在共享主机环境中尤其重要. |
1306天前 |
|
翻译 |
39#翻译 |
Creating Your Own Settings
''''''''''''''''''''''''''
|
创建你自已的Settings |
1306天前 |
|
翻译 |
40#翻译 |
Theres nothing stopping you from creating your own settings, for your own Django applications.
Just follow these conventions:
|
没有什么能够阻止你为自己创建的Django应用创建settings。
只要遵守以下约定: |
1274天前 |
|
翻译 |
41#翻译 |
* Use all uppercase for setting names.
|
* 为所有的配置名使用大写字母。 |
1274天前 |
|
翻译 |
42#翻译 |
* For settings that are sequences, use tuples instead of lists. Settings should be considered
immutable and shouldnt be changed once theyre defined. Using tuples mirrors these semantics.
|
* 对于集合型的设置,使用元组(tuple),而不要使用列表(list)。所有的设置应该是互斥的,并且一旦确定以后就不应该再改变。使用元组也反映了这样的理念。
|
1270天前 |
|
翻译 |
43#翻译 |
* Dont reinvent an already existing setting.
|
* 不要重新创建已经存在的setting。
|
1270天前 |
|
翻译 |
44#翻译 |
Designating the Settings: DJANGO_SETTINGS_MODULE
````````````````````````````````````````````````
|
指派Settings: DJANGO_SETTINGS_MODULE
```````````````````````````````````````````````` |
1292天前 |
|
翻译 |
45#翻译 |
When you use Django, you have to tell it which settings youre using. Do this by using the
environment variable ``DJANGO_SETTINGS_MODULE`` .
|
当你使用 Django 的时候,你必须告诉它你用的哪个 settings (配置),你可以通过设置 ``DJANGO_SETTINGS_MODULE`` 环境变量来完成。 |
1058天前 |
|
翻译 |
46#翻译 |
The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax (e.g.,
``mysite.settings`` ). Note that the settings module should be on the Python import search path
(``PYTHONPATH`` ).
|
``DJANGO_SETTINGS_MODULE`` 的值应该在 Python path 中(例如, ``mysite.settings`` )。注意,settings 模块应该在Python import的搜索路径( ``PYTHONPATH`` )之中。 |
1270天前 |
|
翻译 |
47#翻译 |
Tip:
|
提示: |
1270天前 |
|
翻译 |
48#翻译 |
A good guide to ``PYTHONPATH`` can be found at
`http://diveintopython.org/getting_to_know_python/everything_is_an_object.html`_.
|
关于 ``PYTHONPATH`` 的指导文档可以在 `http://diveintopython.org/getting_to_know_python/everything_is_an_object.html`_ 找到。 |
1270天前 |
|
翻译 |
49#翻译 |
The django-admin.py Utility
'''''''''''''''''''''''''''
|
django-admin.py 工具
''''''''''''''''''''''''''' |
1292天前 |
|
翻译 |
50#翻译 |
When using ``django-admin.py`` (see Appendix G), you can either set the environment variable
once or explicitly pass in the settings module each time you run the utility.
|
当使用 ``django-admin.py`` (见附录G)时,你可以一次性设置环境变量或者在每次运行这个工具时于settings模块中明确指明。 |
1292天前 |
|
翻译 |
51#翻译 |
Heres an example using the Unix Bash shell:
|
这是一个使用Unix Bash Shell的例子: |
1292天前 |
|
翻译 |
54#翻译 |
Heres an example using the Windows shell:
|
这是一个使用Windows命令行的例子: |
1292天前 |
|
翻译 |
57#翻译 |
Use the ``--settings`` command-line argument to specify the settings manually:
|
使用 ``--settings`` 命令行参数来手工指明settings: |
1292天前 |
|
翻译 |
60#翻译 |
The ``manage.py`` utility created by ``startproject`` as part of the project skeleton sets
DJANGO_SETTINGS_MODULE` automatically; see Appendix G for more about ``manage.py`` .
|
由 ``startproject`` 创建的作为工程骨架一部分的 ``manage.py`` 工具会自动设置 DJANGO_SETTINGS_MODULE` ;关于 ``manage.py`` 的详细说明见附录G。 |
1292天前 |
|
翻译 |
61#翻译 |
On the Server (mod_python)
''''''''''''''''''''''''''
|
服务器端(mod_python)
''''''''''''''''''''''''' |
1292天前 |
|
翻译 |
62#翻译 |
In your live server environment, youll need to tell Apache/mod_python which settings file to
use. Do that with ``SetEnv`` :
|
在你的实际服务器环境中,你需要告诉Apache/mod_python使用哪一个settings文件。通过 ``SetEnv`` : |
1292天前 |
|
翻译 |
65#翻译 |
For more information, read the Django mod_python documentation online at
`http://www.djangoproject.com/documentation/0.96/modpython/`_.
|
要了解更详细的信息,请阅读Django mod_python在线手册 `http://www.djangoproject.com/documentation/0.96/modpython/`_ 。 |
1292天前 |
|
翻译 |
66#翻译 |
Using Settings Without Setting DJANGO_SETTINGS_MODULE
`````````````````````````````````````````````````````
|
不设置DJANGO_SETTINGS_MODULE而使用Settings
````````````````````````````````````````````````````` |
1292天前 |
|
翻译 |
67#翻译 |
In some cases, you might want to bypass the ``DJANGO_SETTINGS_MODULE`` environment variable. For
example, if youre using the template system by itself, you likely dont want to have to set up an
environment variable pointing to a settings module.
|
有些情况下,你可能想绕过 ``DJANGO_SETTINGS_MODULE`` 环境变量。例如,如果你正在使用独立的模板系统,你很可能不想设置指向settings模块的环境变量。 |
1292天前 |
|
翻译 |
68#翻译 |
In these cases, you can configure Djangos settings manually. Do this by calling
``django.conf.settings.configure()`` . Heres an example:
|
这在些情况下,你可以手工设置Django的settings,通过 ``django.conf.settings.configure()`` 。这里有一个例子: |
1292天前 |
|
翻译 |
71#翻译 |
Pass ``configure()`` as many keyword arguments as youd like, with each keyword argument
representing a setting and its value. Each argument name should be all uppercase, with the same
name as the settings described earlier. If a particular setting is not passed to ``configure()``
and is needed at some later point, Django will use the default setting value.
|
翻译 |
1482天前 |
|
翻译 |
72#翻译 |
Configuring Django in this fashion is mostly necessary and, indeed, recommended when youre using
a piece of the framework inside a larger application.
|
按照此一風格設置 Django 實則有其必要,尤其當在一個較大的應用程式裡套用一部分框架時. |
919天前 |
|
翻译 |
73#翻译 |
Consequently, when configured via ``settings.configure()`` , Django will not make any
modifications to the process environment variables. (See the explanation of ``TIME_ZONE`` later
in this appendix for why this would normally occur.) Its assumed that youre already in full
control of your environment in these cases.
|
翻译 |
1482天前 |
|
翻译 |
74#翻译 |
Custom Default Settings
'''''''''''''''''''''''
|
定制默认的Settings
''''''''''''''''''''''' |
1292天前 |
|
翻译 |
75#翻译 |
If youd like default values to come from somewhere other than ``django.conf.global_settings`` ,
you can pass in a module or class that provides the default settings as the ``default_settings``
argument (or as the first positional argument) in the call to ``configure()`` .
|
如果你想从 django.conf.global_settings 以外的地方获得默认设置,你可以传入一个提供默认设置当作 default_settings 的参数(或者当作第一个参数) 到回调函数 configure()。 |
1033天前 |
|
翻译 |
76#翻译 |
In this example, default settings are taken from ``myapp_defaults`` , and the ``DEBUG`` setting
is set to ``True`` , regardless of its value in ``myapp_defaults`` :
|
在下面的列子中,默认设置是是从myapp_defaults获取的,且DEBUG是设置为True, regardless of its value in ``myapp_defaults`` : |
1033天前 |
|
翻译 |
79#翻译 |
The following example, which uses ``myapp_defaults`` as a positional argument, is equivalent:
|
下面的例子是等价的: |
1292天前 |
|
翻译 |
82#翻译 |
Normally, you will not need to override the defaults in this fashion. The Django defaults are
sufficiently tame that you can safely use them. Be aware that if you do pass in a new default
module, it entirely *replaces* the Django defaults, so you must specify a value for every
possible setting that might be used in that code you are importing. Check in
``django.conf.settings.global_settings`` for the full list.
|
一般而言,您無需改變其預設值. 您應該可以安全平順地使用 Django 的預設值. 要注意的是,一旦傳進一組新的預設模組,所有的 Django 預設資料將會全部被*取代*,因此,必須在輸入程式碼時,針對每一個可能的設定給值. 請查閱
``django.conf.settings.global_settings`` 了解所有的相關設定. |
919天前 |
|
翻译 |
83#翻译 |
Either configure() or DJANGO_SETTINGS_MODULE Is Required
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
configure()或DJANGO_SETTINGS_MODULE之一是必须的
'''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
1292天前 |
|
翻译 |
84#翻译 |
If youre not setting the ``DJANGO_SETTINGS_MODULE`` environment variable, you *must* call
``configure()`` at some point before using any code that reads settings.
|
如果你没有设置``DJANGO_SETTINGS_MODULE``环境变量,你必须在使用任何读取设置的代码之前的某处调用``configure()`` 方法。 |
872天前 |
|
翻译 |
85#翻译 |
If you dont set ``DJANGO_SETTINGS_MODULE`` and dont call ``configure()`` , Django will raise an
``EnvironmentError`` exception the first time a setting is accessed.
|
如果你没有设置``DJANGO_SETTINGS_MODULE`` 也没有调用``configure()``,当第一次某个setting被访问时,Django 将会出现``EnvironmentError`` 异常。 |
872天前 |
|
翻译 |
86#翻译 |
If you set ``DJANGO_SETTINGS_MODULE`` , access settings values somehow, and *then* call
``configure()`` , Django will raise an ``EnvironmentError`` stating that settings have already
been configured.
|
翻译 |
1482天前 |
|
翻译 |
87#翻译 |
Also, its an error to call ``configure()`` more than once, or to call ``configure()`` after any
setting has been accessed.
|
另外,不止一次或在任何setting已经被访问之后调用``configure()`` 都是错误的。 |
872天前 |
|
翻译 |
88#翻译 |
It boils down to this: use exactly one of either ``configure()`` or ``DJANGO_SETTINGS_MODULE`` .
Not both, and not neither.
|
翻译 |
1482天前 |
|
翻译 |
89#翻译 |
Available Settings
``````````````````
|
可用的設定
`````````````````` |
919天前 |
|
翻译 |
90#翻译 |
The following sections consist of a full list of all available settings, in alphabetical order,
and their default values.
|
下面章节包括全部有效setting项(按字母顺序排序)及其默认值的一个完整列表。 |
1034天前 |
|
翻译 |
91#翻译 |
ABSOLUTE_URL_OVERRIDES
''''''''''''''''''''''
|
ABSOLUTE_URL_OVERRIDES
'''''''''''''''''''''' |
1292天前 |
|
翻译 |
92#翻译 |
*Default* : ``{}`` (empty dictionary)
|
*默认* : ``{}`` (empty dictionary)
|
1291天前 |
|
翻译 |
93#翻译 |
This is a dictionary mapping ``"app_label.model_name"`` strings to functions that take a model
object and return its URL. This is a way of overriding ``get_absolute_url()`` methods on a
per-installation basis. Heres an example:
|
000000000000000000000000000000 |
1066天前 |
|
翻译 |
96#翻译 |
Note that the model name used in this setting should be all lowercase, regardless of the case of
the actual model class name.
|
翻译 |
1482天前 |
|
翻译 |
97#翻译 |
ADMIN_FOR
'''''''''
|
ADMIN_FOR
'''''''''
|
1292天前 |
|
翻译 |
98#翻译 |
*Default* : ``()`` (empty list)
|
*默认* : ``()`` (empty list) |
1291天前 |
|
翻译 |
99#翻译 |
This setting is used for admin site settings modules. It should be a tuple of settings modules
(in the format ``'foo.bar.baz'`` ) for which this site is an admin.
|
翻译 |
1482天前 |
|
翻译 |
100#翻译 |
The admin site uses this in its automatically introspected documentation of models, views, and
template tags.
|
翻译 |
1482天前 |
|
翻译 |
101#翻译 |
ADMIN_MEDIA_PREFIX
''''''''''''''''''
|
ADMIN_MEDIA_PREFIX
'''''''''''''''''' |
1292天前 |
|
翻译 |
102#翻译 |
*Default* : ``'/media/'``
|
*默认* : ``'/media/'``
|
1291天前 |
|
翻译 |
103#翻译 |
This setting is the URL prefix for admin media: CSS, JavaScript, and images. Make sure to use a
trailing slash.
|
此设置是用来设置管理模式的静态文件(包括CSS,JavaScript和图像)URL的前缀。注意要使用斜线 |
566天前 |
|
翻译 |
104#翻译 |
ADMINS
''''''
|
ADMINS
'''''' |
1292天前 |
|
翻译 |
105#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
106#翻译 |
This is a tuple that lists people who get code error notifications. When ``DEBUG=False`` and a
view raises an exception, Django will email these people with the full exception information.
Each member of the tuple should be a tuple of (Full name, e-mail address), for example:
|
翻译 |
1482天前 |
|
翻译 |
109#翻译 |
Note that Django will email *all* of these people whenever an error happens.
|
每当一个错误被捕获的时候,Django 将发送给所有这些人 |
834天前 |
|
翻译 |
110#翻译 |
ALLOWED_INCLUDE_ROOTS
'''''''''''''''''''''
|
ALLOWED_INCLUDE_ROOTS
'''''''''''''''''''''
|
1292天前 |
|
翻译 |
111#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
112#翻译 |
This is a tuple of strings representing allowed prefixes for the ``{% ssi %}`` template tag.
This is a security measure, so that template authors cant access files that they shouldnt be
accessing.
|
翻译 |
1482天前 |
|
翻译 |
113#翻译 |
For example, if ``ALLOWED_INCLUDE_ROOTS`` is ``('/home/html', '/var/www')`` , then ``{% ssi
/home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}`` wouldnt.
|
翻译 |
1482天前 |
|
翻译 |
114#翻译 |
APPEND_SLASH
''''''''''''
|
APPEND_SLASH
''''''''''''
|
1292天前 |
|
翻译 |
115#翻译 |
*Default* : ``True``
|
*默认* : ``True``
|
1291天前 |
|
翻译 |
116#翻译 |
This setting indicates whether to append trailing slashes to URLs. This is used only if
``CommonMiddleware`` is installed (see Chapter 15). See also ``PREPEND_WWW`` .
|
当此设置项为True的时候,系统会自动在URL的尾部加上一个反斜杠'/'。这个设置项仅仅在安装了``CommonMiddleware``的状态下使用(详见第15章)的``PREPEND_WWW`` |
1241天前 |
|
翻译 |
117#翻译 |
CACHE_BACKEND
'''''''''''''
|
CACHE_BACKEND
'''''''''''''
|
1292天前 |
|
翻译 |
118#翻译 |
*Default* : ``'simple://'``
|
*默认* : ``'simple://'``
|
1291天前 |
|
翻译 |
119#翻译 |
This is the cache back-end to use (see Chapter 13).
|
指定使用的缓存后端(见第 13 章)。 |
1140天前 |
|
翻译 |
120#翻译 |
CACHE_MIDDLEWARE_KEY_PREFIX
'''''''''''''''''''''''''''
|
CACHE_MIDDLEWARE_KEY_PREFIX
'''''''''''''''''''''''''''
|
1292天前 |
|
翻译 |
121#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
122#翻译 |
This is the cache key prefix that the cache middleware should use (see Chapter 13).
|
翻译 |
1482天前 |
|
翻译 |
123#翻译 |
DATABASE_ENGINE
'''''''''''''''
|
DATABASE_ENGINE
'''''''''''''''
|
1292天前 |
|
翻译 |
124#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
125#翻译 |
This setting indicates which database back-end to use: ``'postgresql_psycopg2'`` ,
``'postgresql'`` , ``'mysql'`` , ``'mysql_old'`` or ``'sqlite3'`` .
|
该设置用于指定使用下列哪种数据库作为存储后端: ``'postgresql_psycopg2'`` ,
``'postgresql'`` , ``'mysql'`` , ``'mysql_old'`` or ``'sqlite3'`` . |
1204天前 |
|
翻译 |
126#翻译 |
DATABASE_HOST
'''''''''''''
|
DATABASE_HOST
'''''''''''''
|
1292天前 |
|
翻译 |
127#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string) |
1291天前 |
|
翻译 |
128#翻译 |
This setting indicates which host to use when connecting to the database. An empty string means
``localhost`` . This is not used with SQLite.
|
该设置指定连接数据库时所使用的主机。空字符串表示``localhost`` 。如果你使用SQLite,则不用设置该值。 |
1204天前 |
|
翻译 |
129#翻译 |
If this value starts with a forward slash (``'/'`` ) and youre using MySQL, MySQL will connect
via a Unix socket to the specified socket:
|
如果你在使用MySQL,而这个值是以反斜线(``'/'`` )开头,那么MySQL将通过指定的Unix socket进行连接: |
1034天前 |
|
翻译 |
132#翻译 |
If youre using MySQL and this value *doesnt* start with a forward slash, then this value is
assumed to be the host.
|
如果你在使用MySQL,而这个值又没有以反斜线开头,那么这个值就被视为是主机。 |
1034天前 |
|
翻译 |
133#翻译 |
DATABASE_NAME
'''''''''''''
|
DATABASE_NAME
'''''''''''''
|
1292天前 |
|
翻译 |
134#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
135#翻译 |
This is the name of the database to use. For SQLite, its the full path to the database file.
|
该设置为所使用数据库的名称。如果使用SQLite,该设置为数据库文件的完整路径。 |
1204天前 |
|
翻译 |
136#翻译 |
DATABASE_OPTIONS
''''''''''''''''
|
DATABASE_OPTIONS
''''''''''''''''
|
1292天前 |
|
翻译 |
137#翻译 |
*Default* : ``{}`` (empty dictionary)
|
*默认* : ``{}`` (empty dictionary)
|
1291天前 |
|
翻译 |
138#翻译 |
This is extra parameters to use when connecting to the database. Consult the back-end modules
document for available keywords.
|
翻译 |
1482天前 |
|
翻译 |
139#翻译 |
DATABASE_PASSWORD
'''''''''''''''''
|
DATABASE_PASSWORD
'''''''''''''''''
|
1292天前 |
|
翻译 |
140#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
141#翻译 |
This setting is the password to use when connecting to the database. It is not used with SQLite.
|
该设置为数据库连接密码。如果使用SQLite,则不用设置。 |
1204天前 |
|
翻译 |
142#翻译 |
DATABASE_PORT
'''''''''''''
|
DATABASE_PORT
'''''''''''''
|
1292天前 |
|
翻译 |
143#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
144#翻译 |
This is the port to use when connecting to the database. An empty string means the default port.
It is not used with SQLite.
|
这是用来连接数据库的端口. 空字符代表缺省端口.
SQLite 不用设置.
|
1021天前 |
|
翻译 |
145#翻译 |
DATABASE_USER
'''''''''''''
|
DATABASE_USER
'''''''''''''
|
1292天前 |
|
翻译 |
146#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
147#翻译 |
This setting is the username to use when connecting to the database. It is not used with SQLite.
|
该设置为连接数据库的用户名。当使用 SQLite 时无效。 |
1140天前 |
|
翻译 |
148#翻译 |
DATE_FORMAT
'''''''''''
|
DATE_FORMAT
'''''''''''
|
1292天前 |
|
翻译 |
149#翻译 |
*Default* : ``'N j, Y'`` (e.g., ``Feb. 4, 2003`` )
|
*默认* : ``'N j, Y'`` (e.g., ``Feb. 4, 2003`` )
|
1291天前 |
|
翻译 |
150#翻译 |
This is the default formatting to use for date fields on Django admin change-list pages and,
possibly, by other parts of the system. It accepts the same format as the ``now`` tag (see
Appendix F, Table F-2).
|
翻译 |
1482天前 |
|
翻译 |
151#翻译 |
See also ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , and
``MONTH_DAY_FORMAT`` .
|
另见 ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , 和
``MONTH_DAY_FORMAT`` .
|
1291天前 |
|
翻译 |
152#翻译 |
DATETIME_FORMAT
'''''''''''''''
|
DATETIME_FORMAT
'''''''''''''''
|
1292天前 |
|
翻译 |
153#翻译 |
*Default* : ``'N j, Y, P'`` (e.g., ``Feb. 4, 2003, 4 p.m.`` )
|
*默认* : ``'N j, Y, P'`` (例如, ``Feb. 4, 2003, 4 p.m.`` )
|
1291天前 |
|
翻译 |
154#翻译 |
This is the default formatting to use for datetime fields on Django admin change-list pages and,
possibly, by other parts of the system. It accepts the same format as the ``now`` tag (see
Appendix F, Table F-2).
|
翻译 |
1482天前 |
|
翻译 |
155#翻译 |
See also ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , and
``MONTH_DAY_FORMAT`` .
|
另见 ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , 和
``MONTH_DAY_FORMAT`` .
|
1291天前 |
|
翻译 |
156#翻译 |
DEBUG
'''''
|
DEBUG
'''''
|
1292天前 |
|
翻译 |
157#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
158#翻译 |
This setting is a Boolean that turns debug mode on and off.
|
这个设置项是一个标示debug开关的布尔值。 |
872天前 |
|
翻译 |
159#翻译 |
If you define custom settings, ``django/views/debug.py`` has a ``HIDDEN_SETTINGS`` regular
expression that will hide from the ``DEBUG`` view anything that contains ``'SECRET`` ,
``PASSWORD`` , or ``PROFANITIES'`` . This allows untrusted users to be able to give backtraces
without seeing sensitive (or offensive) settings.
|
翻译 |
1482天前 |
|
翻译 |
160#翻译 |
Still, note that there are always going to be sections of your debug output that are
inappropriate for public consumption. File paths, configuration options, and the like all give
attackers extra information about your server. Never deploy a site with ``DEBUG`` turned on.
|
翻译 |
1482天前 |
|
翻译 |
161#翻译 |
DEFAULT_CHARSET
'''''''''''''''
|
DEFAULT_CHARSET
''''''''''''''' |
1292天前 |
|
翻译 |
162#翻译 |
*Default* : ``'utf-8'``
|
*默认* : ``'utf-8'`` |
1291天前 |
|
翻译 |
163#翻译 |
This is the default charset to use for all ``HttpResponse`` objects, if a MIME type isnt
manually specified. It is used with ``DEFAULT_CONTENT_TYPE`` to construct the ``Content-Type``
header. See Appendix H for more about ``HttpResponse`` objects.
|
翻译 |
1291天前 |
|
翻译 |
164#翻译 |
DEFAULT_CONTENT_TYPE
''''''''''''''''''''
|
DEFAULT_CONTENT_TYPE
'''''''''''''''''''' |
1291天前 |
|
翻译 |
165#翻译 |
*Default* : ``'text/html'``
|
*默认* : ``'text/html'``
|
1291天前 |
|
翻译 |
166#翻译 |
This is the default content type to use for all ``HttpResponse`` objects, if a MIME type isnt
manually specified. It is used with ``DEFAULT_CHARSET`` to construct the ``Content-Type``
header. See Appendix H for more about ``HttpResponse`` objects.
|
翻译 |
1291天前 |
|
翻译 |
167#翻译 |
DEFAULT_FROM_EMAIL
''''''''''''''''''
|
DEFAULT_FROM_EMAIL
''''''''''''''''''
|
1291天前 |
|
翻译 |
168#翻译 |
*Default* : ``'webmaster@localhost'``
|
*默认* : ``'webmaster@localhost'``
|
1291天前 |
|
翻译 |
169#翻译 |
This is the default email address to use for various automated correspondence from the site
manager(s).
|
翻译 |
1291天前 |
|
翻译 |
170#翻译 |
DISALLOWED_USER_AGENTS
''''''''''''''''''''''
|
DISALLOWED_USER_AGENTS
'''''''''''''''''''''' |
1291天前 |
|
翻译 |
171#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple) |
1291天前 |
|
翻译 |
172#翻译 |
This is a list of compiled regular expression objects representing User-Agent strings that are
not allowed to visit any page, systemwide. Use this for bad robots/crawlers. This is used only
if ``CommonMiddleware`` is installed (see Chapter 15).
|
翻译 |
1291天前 |
|
翻译 |
173#翻译 |
EMAIL_HOST
''''''''''
|
EMAIL_HOST
''''''''''
|
1291天前 |
|
翻译 |
174#翻译 |
*Default* : ``'localhost'``
|
*默认* : ``'localhost'``
|
1291天前 |
|
翻译 |
175#翻译 |
This is the host to use for sending email. See also ``EMAIL_PORT`` .
|
翻译 |
1291天前 |
|
翻译 |
176#翻译 |
EMAIL_HOST_PASSWORD
'''''''''''''''''''
|
EMAIL_HOST_PASSWORD
'''''''''''''''''''
|
1291天前 |
|
翻译 |
177#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
178#翻译 |
This is the password to use for the SMTP server defined in ``EMAIL_HOST`` . This setting is used
in conjunction with ``EMAIL_HOST_USER`` when authenticating to the SMTP server. If either of
these settings is empty, Django wont attempt authentication.
|
翻译 |
1291天前 |
|
翻译 |
179#翻译 |
See also ``EMAIL_HOST_USER`` .
|
另见 ``EMAIL_HOST_USER`` .
|
1291天前 |
|
翻译 |
180#翻译 |
EMAIL_HOST_USER
'''''''''''''''
|
EMAIL_HOST_USER
'''''''''''''''
|
1291天前 |
|
翻译 |
181#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string) |
1291天前 |
|
翻译 |
182#翻译 |
This is the username to use for the SMTP server defined in ``EMAIL_HOST`` . If its empty, Django
wont attempt authentication. See also ``EMAIL_HOST_PASSWORD`` .
|
翻译 |
1291天前 |
|
翻译 |
183#翻译 |
EMAIL_PORT
''''''''''
|
EMAIL_PORT
''''''''''
|
1291天前 |
|
翻译 |
184#翻译 |
*Default* : ``25``
|
*默认* : ``25``
|
1291天前 |
|
翻译 |
185#翻译 |
This is the port to use for the SMTP server defined in ``EMAIL_HOST`` .
|
翻译 |
1291天前 |
|
翻译 |
186#翻译 |
EMAIL_SUBJECT_PREFIX
''''''''''''''''''''
|
EMAIL_SUBJECT_PREFIX
''''''''''''''''''''
|
1291天前 |
|
翻译 |
187#翻译 |
*Default* : ``'[Django] '``
|
*默认* : ``'[Django] '``
|
1291天前 |
|
翻译 |
188#翻译 |
This is the subject-line prefix for email messages sent with ``django.core.mail.mail_admins`` or
``django.core.mail.mail_managers`` . Youll probably want to include the trailing space.
|
翻译 |
1291天前 |
|
翻译 |
189#翻译 |
FIXTURE_DIRS
''''''''''''
|
FIXTURE_DIRS
''''''''''''
|
1291天前 |
|
翻译 |
190#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
191#翻译 |
This is a list of locations of the fixture data files, in search order. Note that these paths
should use Unix-style forward slashes, even on Windows. It is used by Djangos testing framework,
which is covered online at `http://www.djangoproject.com/documentation/0.96/testing/`_.
|
翻译 |
1291天前 |
|
翻译 |
192#翻译 |
IGNORABLE_404_ENDS
''''''''''''''''''
|
IGNORABLE_404_ENDS
''''''''''''''''''
|
1291天前 |
|
翻译 |
193#翻译 |
*Default* : ``('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')``
|
*默认* : ``('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')``
|
1291天前 |
|
翻译 |
194#翻译 |
See also ``IGNORABLE_404_STARTS`` and ``Error reporting via e-mail`` .
|
另见 ``IGNORABLE_404_STARTS`` 和 ``Error reporting via e-mail`` .
|
1291天前 |
|
翻译 |
195#翻译 |
IGNORABLE_404_STARTS
''''''''''''''''''''
|
IGNORABLE_404_STARTS
''''''''''''''''''''
|
1291天前 |
|
翻译 |
196#翻译 |
*Default* : ``('/cgi-bin/', '/_vti_bin', '/_vti_inf')``
|
*默认* : ``('/cgi-bin/', '/_vti_bin', '/_vti_inf')``
|
1291天前 |
|
翻译 |
197#翻译 |
This is a tuple of strings that specify beginnings of URLs that should be ignored by the 404
emailer. See also ``SEND_BROKEN_LINK_EMAILS`` and ``IGNORABLE_404_ENDS`` .
|
翻译 |
1291天前 |
|
翻译 |
198#翻译 |
INSTALLED_APPS
''''''''''''''
|
INSTALLED_APPS
''''''''''''''
|
1291天前 |
|
翻译 |
199#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
200#翻译 |
A tuple of strings designating all applications that are enabled in this Django installation.
Each string should be a full Python path to a Python package that contains a Django application.
See Chapter 5 for more about applications.
|
翻译 |
1291天前 |
|
翻译 |
201#翻译 |
INTERNAL_IPS
''''''''''''
|
INTERNAL_IPS
''''''''''''
|
1291天前 |
|
翻译 |
202#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
203#翻译 |
A tuple of IP addresses, as strings, that
|
翻译 |
1482天前 |
|
翻译 |
204#翻译 |
* See debug comments, when ``DEBUG`` is ``True``
|
翻译 |
1482天前 |
|
翻译 |
205#翻译 |
* Receive X headers if the ``XViewMiddleware`` is installed (see Chapter 15)
|
翻译 |
1482天前 |
|
翻译 |
206#翻译 |
JING_PATH
'''''''''
|
JING_PATH
'''''''''
|
1291天前 |
|
翻译 |
207#翻译 |
*Default* : ``'/usr/bin/jing'``
|
*默认* : ``'/usr/bin/jing'``
|
1291天前 |
|
翻译 |
208#翻译 |
This is the path to the Jing executable. Jing is a RELAX NG validator, and Django uses it to
validate each ``XMLField`` in your models. See
`http://www.thaiopensource.com/relaxng/jing.html`_.
|
翻译 |
1482天前 |
|
翻译 |
209#翻译 |
LANGUAGE_CODE
'''''''''''''
|
LANGUAGE_CODE
'''''''''''''
|
1291天前 |
|
翻译 |
210#翻译 |
*Default* : ``'en-us'``
|
*默认* : ``'en-us'``
|
1291天前 |
|
翻译 |
211#翻译 |
This is a string representing the language code for this installation. This should be in
standard language format for example, U.S. English is ``"en-us"`` . See Chapter 18.
|
翻译 |
1482天前 |
|
翻译 |
212#翻译 |
LANGUAGES
'''''''''
|
LANGUAGES
'''''''''
|
1291天前 |
|
翻译 |
213#翻译 |
*Default* : A tuple of all available languages. This list is continually growing and any copy
included here would inevitably become rapidly out of date. You can see the current list of
translated languages by looking in ``django/conf/global_settings.py`` .
|
翻译 |
1291天前 |
|
翻译 |
214#翻译 |
The list is a tuple of two-tuples in the format (language code, language name) for example,
``('ja', 'Japanese')`` . This specifies which languages are available for language selection.
See Chapter 18 for more on language selection.
|
翻译 |
1482天前 |
|
翻译 |
215#翻译 |
Generally, the default value should suffice. Only set this setting if you want to restrict
language selection to a subset of the Django-provided languages.
|
翻译 |
1482天前 |
|
翻译 |
216#翻译 |
If you define a custom ``LANGUAGES`` setting, its OK to mark the languages as translation
strings, but you should *never* import ``django.utils.translation`` from within your settings
file, because that module in itself depends on the settings, and that would cause a circular
import.
|
翻译 |
1482天前 |
|
翻译 |
217#翻译 |
The solution is to use a dummy ``gettext()`` function. Heres a sample settings file:
|
翻译 |
1482天前 |
|
翻译 |
220#翻译 |
With this arrangement, ``make-messages.py`` will still find and mark these strings for
translation, but the translation wont happen at runtime so youll have to remember to wrap the
languages in the *real* ``gettext()`` in any code that uses ``LANGUAGES`` at runtime.
|
翻译 |
1482天前 |
|
翻译 |
221#翻译 |
MANAGERS
''''''''
|
MANAGERS
''''''''
|
1291天前 |
|
翻译 |
222#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
223#翻译 |
This tuple is in the same format as ``ADMINS`` that specifies who should get broken-link
notifications when ``SEND_BROKEN_LINK_EMAILS=True`` .
|
翻译 |
1482天前 |
|
翻译 |
224#翻译 |
MEDIA_ROOT
''''''''''
|
MEDIA_ROOT
''''''''''
|
1291天前 |
|
翻译 |
225#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
226#翻译 |
This is an absolute path to the directory that holds media for this installation (e.g.,
``"/home/media/media.lawrence.com/"`` ). See also ``MEDIA_URL`` .
|
翻译 |
1482天前 |
|
翻译 |
227#翻译 |
MEDIA_URL
'''''''''
|
MEDIA_URL
'''''''''
|
1291天前 |
|
翻译 |
228#翻译 |
*Default* : ``''`` (empty string)
|
*默认* : ``''`` (empty string)
|
1291天前 |
|
翻译 |
229#翻译 |
This URL handles the media served from ``MEDIA_ROOT`` (e.g., ``"http://media.lawrence.com"`` ).
|
翻译 |
1482天前 |
|
翻译 |
230#翻译 |
Note that this should have a trailing slash if it has a path component:
|
翻译 |
1482天前 |
|
翻译 |
231#翻译 |
* *Correct* : ``"http://www.example.com/static/"``
|
* *正确* : ``"http://www.example.com/static/"`` |
1291天前 |
|
翻译 |
232#翻译 |
* *Incorrect* : ``"http://www.example.com/static"``
|
* *错误* : ``"http://www.example.com/static"``
|
1291天前 |
|
翻译 |
233#翻译 |
MIDDLEWARE_CLASSES
''''''''''''''''''
|
MIDDLEWARE_CLASSES
'''''''''''''''''' |
1291天前 |
|
翻译 |
234#翻译 |
*Default* :
|
*默认* :
|
1291天前 |
|
翻译 |
237#翻译 |
This is a tuple of middleware classes to use. See Chapter 15.
|
翻译 |
1482天前 |
|
翻译 |
238#翻译 |
MONTH_DAY_FORMAT
''''''''''''''''
|
MONTH_DAY_FORMAT
''''''''''''''''
|
1291天前 |
|
翻译 |
239#翻译 |
*Default* : ``'F j'``
|
*默认* : ``'F j'``
|
1291天前 |
|
翻译 |
240#翻译 |
This is the default formatting to use for date fields on Django admin change-list pages and,
possibly, by other parts of the system in cases when only the month and day are displayed. It
accepts the same format as the ``now`` tag (see Appendix F, Table F-2).
|
翻译 |
1482天前 |
|
翻译 |
241#翻译 |
For example, when a Django admin change-list page is being filtered by a date, the header for a
given day displays the day and month. Different locales have different formats. For example,
U.S. English would have January 1, whereas Spanish might have 1 Enero.
|
翻译 |
1482天前 |
|
翻译 |
242#翻译 |
See also ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , and ``YEAR_MONTH_FORMAT`` .
|
另见 ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , 和 ``YEAR_MONTH_FORMAT`` .
|
1291天前 |
|
翻译 |
243#翻译 |
PREPEND_WWW
'''''''''''
|
PREPEND_WWW
''''''''''' |
1291天前 |
|
翻译 |
244#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
245#翻译 |
This setting indicates whether to prepend the www. subdomain to URLs that dont have it. This is
used only if ``CommonMiddleware`` is installed (see the Chapter 15). See also ``APPEND_SLASH`` .
|
翻译 |
1482天前 |
|
翻译 |
246#翻译 |
PROFANITIES_LIST
''''''''''''''''
|
PROFANITIES_LIST
''''''''''''''''
|
1291天前 |
|
翻译 |
247#翻译 |
This is a tuple of profanities, as strings, that will trigger a validation error when the
``hasNoProfanities`` validator is called.
|
翻译 |
1482天前 |
|
翻译 |
248#翻译 |
We dont list the default values here, because that might bring the MPAA ratings board down on
our heads. To view the default values, see the file ``django/conf/global_settings.py`` .
|
翻译 |
1482天前 |
|
翻译 |
249#翻译 |
ROOT_URLCONF
''''''''''''
|
ROOT_URLCONF
''''''''''''
|
1291天前 |
|
翻译 |
250#翻译 |
*Default* : Not defined
|
*默认* : Not defined
|
1291天前 |
|
翻译 |
251#翻译 |
This is a string representing the full Python import path to your root URLconf (e.g.,
``"mydjangoapps.urls"`` ). See Chapter 3.
|
翻译 |
1482天前 |
|
翻译 |
252#翻译 |
SECRET_KEY
''''''''''
|
SECRET_KEY
''''''''''
|
1291天前 |
|
翻译 |
253#翻译 |
*Default* : (Generated automatically when you start a project)
|
*默认* : (当你创建一个项目时自动生成)
|
1291天前 |
|
翻译 |
254#翻译 |
This is a secret key for this particular Django installation. It is used to provide a seed in
secret-key hashing algorithms. Set this to a random string the longer, the better.
``django-admin.py startproject`` creates one automatically and most of the time you wont need to
change it
|
翻译 |
1482天前 |
|
翻译 |
255#翻译 |
SEND_BROKEN_LINK_EMAILS
'''''''''''''''''''''''
|
SEND_BROKEN_LINK_EMAILS
'''''''''''''''''''''''
|
1291天前 |
|
翻译 |
256#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
257#翻译 |
This setting indicates whether to send an email to the ``MANAGERS`` each time somebody visits a
Django-powered page that is 404-ed with a nonempty referer (i.e., a broken link). This is only
used if ``CommonMiddleware`` is installed (see Chapter 15). See also ``IGNORABLE_404_STARTS``
and ``IGNORABLE_404_ENDS`` .
|
翻译 |
1482天前 |
|
翻译 |
258#翻译 |
SERIALIZATION_MODULES
'''''''''''''''''''''
|
SERIALIZATION_MODULES
'''''''''''''''''''''
|
1291天前 |
|
翻译 |
259#翻译 |
*Default* : Not defined.
|
*默认* : Not defined.
|
1291天前 |
|
翻译 |
260#翻译 |
Serialization is a feature still under heavy development. Refer to the online documentation at
`http://www.djangoproject.com/documentation/0.96/serialization/`_ for more information.
|
翻译 |
1482天前 |
|
翻译 |
261#翻译 |
SERVER_EMAIL
''''''''''''
|
SERVER_EMAIL
''''''''''''
|
1291天前 |
|
翻译 |
262#翻译 |
*Default* : ``'root@localhost'``
|
*默认* : ``'root@localhost'``
|
1291天前 |
|
翻译 |
263#翻译 |
This is the email address that error messages come from, such as those sent to ``ADMINS`` and
``MANAGERS`` .
|
翻译 |
1482天前 |
|
翻译 |
264#翻译 |
SESSION_COOKIE_AGE
''''''''''''''''''
|
SESSION_COOKIE_AGE
''''''''''''''''''
|
1291天前 |
|
翻译 |
265#翻译 |
*Default* : ``1209600`` (two weeks, in seconds)
|
*默认* : ``1209600`` (两周,以秒计)
|
1291天前 |
|
翻译 |
266#翻译 |
This is the age of session cookies, in seconds. See Chapter 12.
|
翻译 |
1482天前 |
|
翻译 |
267#翻译 |
SESSION_COOKIE_DOMAIN
'''''''''''''''''''''
|
SESSION_COOKIE_DOMAIN
'''''''''''''''''''''
|
1291天前 |
|
翻译 |
268#翻译 |
*Default* : ``None``
|
*默认* : ``None``
|
1291天前 |
|
翻译 |
269#翻译 |
This is the domain to use for session cookies. Set this to a string such as ``".lawrence.com"``
for cross-domain cookies, or use ``None`` for a standard domain cookie. See Chapter 12.
|
翻译 |
1291天前 |
|
翻译 |
270#翻译 |
SESSION_COOKIE_NAME
'''''''''''''''''''
|
SESSION_COOKIE_NAME
'''''''''''''''''''
|
1291天前 |
|
翻译 |
271#翻译 |
*Default* : ``'sessionid'``
|
*默认* : ``'sessionid'``
|
1291天前 |
|
翻译 |
272#翻译 |
This is the name of the cookie to use for sessions; it can be whatever you want. See Chapter 12.
|
翻译 |
1482天前 |
|
翻译 |
273#翻译 |
SESSION_COOKIE_SECURE
'''''''''''''''''''''
|
SESSION_COOKIE_SECURE
''''''''''''''''''''' |
1291天前 |
|
翻译 |
274#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
275#翻译 |
This setting indicates whether to use a secure cookie for the session cookie. If this is set to
``True`` , the cookie will be marked as secure, which means browsers may ensure that the cookie
is only sent under an HTTPS connection. See Chapter 12.
|
翻译 |
1482天前 |
|
翻译 |
276#翻译 |
SESSION_EXPIRE_AT_BROWSER_CLOSE
'''''''''''''''''''''''''''''''
|
SESSION_EXPIRE_AT_BROWSER_CLOSE
'''''''''''''''''''''''''''''''
|
1291天前 |
|
翻译 |
277#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
278#翻译 |
This setting indicates whether to expire the session when the user closes his browser. See
Chapter 12.
|
翻译 |
1482天前 |
|
翻译 |
279#翻译 |
SESSION_SAVE_EVERY_REQUEST
''''''''''''''''''''''''''
|
SESSION_SAVE_EVERY_REQUEST
''''''''''''''''''''''''''
|
1291天前 |
|
翻译 |
280#翻译 |
*Default* : ``False``
|
*默认* : ``False`` |
1291天前 |
|
翻译 |
281#翻译 |
This setting indicates whether to save the session data on every request. See Chapter 12.
|
翻译 |
1482天前 |
|
翻译 |
282#翻译 |
SITE_ID
'''''''
|
SITE_ID
''''''' |
1291天前 |
|
翻译 |
283#翻译 |
*Default* : Not defined
|
*默认* : Not defined
|
1291天前 |
|
翻译 |
284#翻译 |
This is the ID, as an integer, of the current site in the ``django_site`` database table. It is
used so that application data can hook into specific site(s) and a single database can manage
content for multiple sites. See Chapter 14.
|
这就是在“django_site”数据库表中当前网站的整数ID。它常用于应用程序数据能够挂钩到指定的网站,或单个数据库上能管理多个网站的内容。参见第14章。 |
1119天前 |
|
翻译 |
285#翻译 |
TEMPLATE_CONTEXT_PROCESSORS
'''''''''''''''''''''''''''
|
TEMPLATE_CONTEXT_PROCESSORS
'''''''''''''''''''''''''''
|
1291天前 |
|
翻译 |
286#翻译 |
*Default* :
|
*默认* :
|
1291天前 |
|
翻译 |
289#翻译 |
This is a tuple of callables that are used to populate the context in ``RequestContext`` . These
callables take a request object as their argument and return a dictionary of items to be merged
into the context. See Chapter 10.
|
翻译 |
1482天前 |
|
翻译 |
290#翻译 |
TEMPLATE_DEBUG
''''''''''''''
|
TEMPLATE_DEBUG
''''''''''''''
|
1291天前 |
|
翻译 |
291#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
292#翻译 |
This Boolean turns template debug mode on and off. If it is ``True`` , the fancy error page will
display a detailed report for any ``TemplateSyntaxError`` . This report contains the relevant
snippet of the template, with the appropriate line highlighted.
|
翻译 |
1482天前 |
|
翻译 |
293#翻译 |
Note that Django only displays fancy error pages if ``DEBUG`` is ``True`` , so youll want to set
that to take advantage of this setting.
|
翻译 |
1482天前 |
|
翻译 |
294#翻译 |
See also ``DEBUG`` .
|
另见 ``DEBUG`` .
|
1291天前 |
|
翻译 |
295#翻译 |
TEMPLATE_DIRS
'''''''''''''
|
TEMPLATE_DIRS
'''''''''''''
|
1291天前 |
|
翻译 |
296#翻译 |
*Default* : ``()`` (empty tuple)
|
*默认* : ``()`` (empty tuple)
|
1291天前 |
|
翻译 |
297#翻译 |
This is a list of locations of the template source files, in search order. Note that these paths
should use Unix-style forward slashes, even on Windows. See Chapters 4 and 10.
|
这是一个根据搜索排序的模板源文件的位置列表。注意,这些路径应该使用Unix风格的分割符,即使在Windows上。参加第4和10章。 |
924天前 |
|
翻译 |
298#翻译 |
TEMPLATE_LOADERS
''''''''''''''''
|
TEMPLATE_LOADERS
''''''''''''''''
|
1291天前 |
|
翻译 |
299#翻译 |
*Default* : ``('django.template.loaders.filesystem.load_template_source',)``
|
*默认* : ``('django.template.loaders.filesystem.load_template_source',)``
|
1291天前 |
|
翻译 |
300#翻译 |
This is a tuple of callables (as strings) that know how to import templates from various
sources. See Chapter 10.
|
翻译 |
1482天前 |
|
翻译 |
301#翻译 |
TEMPLATE_STRING_IF_INVALID
''''''''''''''''''''''''''
|
TEMPLATE_STRING_IF_INVALID
''''''''''''''''''''''''''
|
1291天前 |
|
翻译 |
302#翻译 |
*Default* : ``''`` (Empty string)
|
*默认* : ``''`` (Empty string)
|
1291天前 |
|
翻译 |
303#翻译 |
This is output, as a string, that the template system should use for invalid (e.g., misspelled)
variables. See Chapter 10.
|
翻译 |
1482天前 |
|
翻译 |
304#翻译 |
TEST_RUNNER
'''''''''''
|
TEST_RUNNER
'''''''''''
|
1291天前 |
|
翻译 |
305#翻译 |
*Default* : ``'django.test.simple.run_tests'``
|
*默认* : ``'django.test.simple.run_tests'``
|
1291天前 |
|
翻译 |
306#翻译 |
This is the name of the method to use for starting the test suite. It is used by Djangos testing
framework, which is covered online at
`http://www.djangoproject.com/documentation/0.96/testing/`_.
|
这是用于启动测试套件的方法名称。它用在Django测试框架中,参见http://www.djangoproject.com/documentation/0.96/testing 。 |
924天前 |
|
翻译 |
307#翻译 |
TEST_DATABASE_NAME
''''''''''''''''''
|
TEST_DATABASE_NAME
'''''''''''''''''' |
1291天前 |
|
翻译 |
308#翻译 |
*Default* : ``None``
|
*默认* : ``None``
|
1291天前 |
|
翻译 |
309#翻译 |
This is the name of database to use when running the test suite. If a value of ``None`` is
specified, the test database will use the name ``'test_' + settings.DATABASE_NAME`` . See the
documentation for Djangos testing framework, which is covered online at
`http://www.djangoproject.com/documentation/0.96/testing/`_.
|
这是用于执行测试套件的数据名称。如果该值为None, 那么测试数据库将会使用名称'test_' + settings.DATABASE_NAME。参见Django测试框架的文档,位于http://www.djangoproject.com/documentation/0.96/testing/ 。 |
924天前 |
|
翻译 |
310#翻译 |
TIME_FORMAT
'''''''''''
|
TIME_FORMAT
'''''''''''
|
1291天前 |
|
翻译 |
311#翻译 |
*Default* : ``'P'`` (e.g., ``4 p.m.`` )
|
*默认* : ``'P'`` (e.g., ``4 p.m.`` )
|
1291天前 |
|
翻译 |
312#翻译 |
This is the default formatting to use for time fields on Django admin change-list pages and,
possibly, by other parts of the system. It accepts the same format as the ``now`` tag (see
Appendix F, Table F-2).
|
翻译 |
1482天前 |
|
翻译 |
313#翻译 |
See also ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , and
``MONTH_DAY_FORMAT`` .
|
另见 ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , ``YEAR_MONTH_FORMAT`` , 和
``MONTH_DAY_FORMAT`` . |
1291天前 |
|
翻译 |
314#翻译 |
TIME_ZONE
'''''''''
|
TIME_ZONE
'''''''''
|
1291天前 |
|
翻译 |
315#翻译 |
*Default* : ``'America/Chicago'``
|
*默认* : ``'America/Chicago'``
|
1291天前 |
|
翻译 |
316#翻译 |
This is a string representing the time zone for this installation. Time zones are in the
Unix-standard ``zic`` format. One relatively complete list of time zone strings can be found at
`http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE`_.
|
此字符串表示安装的时区。时区为Unix标准的zic格式。在http://www.postgresql.org/docs/8.1/static/dateime-keywords.html#DATETIME-TIMEZONE-SET-TABLE上有一个相对完整的时区字符串列表。 |
1164天前 |
|
翻译 |
317#翻译 |
This is the time zone to which Django will convert all dates/times not necessarily the time zone
of the server. For example, one server may serve multiple Django-powered sites, each with a
separate time-zone setting.
|
这是Django转换包括服务器时区在内的所有日期/时间时所用的时区。例如,一个服务器可以托管多个Django站点,每个站点有一个独立的时区设置。 |
37天前 |
|
翻译 |
318#翻译 |
Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you specify in the
``TIME_ZONE`` setting. Thus, all your views and models will automatically operate in the correct
time zone. However, if youre using the manually configuring settings (described above in the
section titled Using Settings Without Setting DJANGO_SETTINGS_MODULE), Django will *not* touch
the ``TZ`` environment variable, and it will be up to you to ensure your processes are running
in the correct environment.
|
翻译 |
1482天前 |
|
翻译 |
319#翻译 |
Note
|
注意 |
1291天前 |
|
翻译 |
320#翻译 |
Django cannot reliably use alternate time zones in a Windows environment. If youre running
Django on Windows, this variable must be set to match the system time zone.
|
Django不能可靠地使用Windows环境里的可选时区。如果你在Windows上运行Django,这个变量必须设置为与系统时区一致。 |
924天前 |
|
翻译 |
321#翻译 |
URL_VALIDATOR_USER_AGENT
''''''''''''''''''''''''
|
URL_VALIDATOR_USER_AGENT
''''''''''''''''''''''''
|
1291天前 |
|
翻译 |
322#翻译 |
*Default* : ``Django/<version> (http://www.djangoproject.com/)``
|
*默认* : ``Django/<version> (http://www.djangoproject.com/)``
|
1291天前 |
|
翻译 |
323#翻译 |
This is the string to use as the ``User-Agent`` header when checking to see if URLs exist (see
the ``verify_exists`` option on ``URLField`` ; see Appendix B).
|
这是当检查url是否存在时用于“User-Agent”的字符串( 参见“URLField”的“verify_exists”选项;参见附录B)。 |
924天前 |
|
翻译 |
324#翻译 |
USE_ETAGS
'''''''''
|
USE_ETAGS
'''''''''
|
1291天前 |
|
翻译 |
325#翻译 |
*Default* : ``False``
|
*默认* : ``False``
|
1291天前 |
|
翻译 |
326#翻译 |
This Boolean specifies whether to output the ETag header. It saves bandwidth but slows down
performance. This is only used if ``CommonMiddleware`` is installed (see Chapter 15).
|
此逻辑值指定是否输出ETag前缀。这会节省带宽但是降低性能。一般只有当安装了时才使用此选项(参见第15章)。 |
924天前 |
|
翻译 |
327#翻译 |
USE_I18N
''''''''
|
USE_I18N
''''''''
|
1291天前 |
|
翻译 |
328#翻译 |
*Default* : ``True``
|
*默认* : ``True``
|
1291天前 |
|
翻译 |
329#翻译 |
This Boolean specifies whether Djangos internationalization system (see Chapter 18) should be
enabled. It provides an easy way to turn off internationalization, for performance. If this is
set to ``False`` , Django will make some optimizations so as not to load the
internationalization machinery.
|
此逻辑值指定Django国际化系统(参见第18章)是否可用。这提供了一个因为性能而关闭国际化的简单方法。如果此值设为“False”,Django将会做一些优化以替代未加载的国际化机制。 |
924天前 |
|
翻译 |
330#翻译 |
YEAR_MONTH_FORMAT
'''''''''''''''''
|
YEAR_MONTH_FORMAT
'''''''''''''''''
|
1291天前 |
|
翻译 |
331#翻译 |
*Default* : ``'F Y'``
|
*默认* : ``'F Y'``
|
1291天前 |
|
翻译 |
332#翻译 |
This is the default formatting to use for date fields on Django admin change-list pages and,
possibly, by other parts of the system in cases when only the year and month are displayed. It
accepts the same format as the ``now`` tag (see Appendix F).
|
这是默认格式,用于Django管理变更列表页面的日期域,并且有可能,也用于系统其他部分的只显示年月的情况。“now”标签接受相同的格式。(参见附录F)。 |
924天前 |
|
翻译 |
333#翻译 |
For example, when a Django admin change-list page is being filtered by a date drill-down, the
header for a given month displays the month and the year. Different locales have different
formats. For example, U.S. English would use January 2006, whereas another locale might use
2006/January.
|
例如,当一个Django管理变更列表也被一个日期过滤时,给出的月份前缀会显示出年月。不同的地区有不同的格式,比如美国英语会使用January 2006,而其他地区可能使用2006/January。 |
924天前 |
|
翻译 |
334#翻译 |
See also ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , and ``MONTH_DAY_FORMAT`` .
|
另见 ``DATE_FORMAT`` , ``DATETIME_FORMAT`` , ``TIME_FORMAT`` , 和 ``MONTH_DAY_FORMAT`` .
|
1291天前 |
|
翻译 |