mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
magic-removal: Proofread docs/settings.txt
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2789 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ecd3d2e8c7
commit
71468fad80
@ -19,7 +19,7 @@ Here are a couple of example settings::
|
|||||||
|
|
||||||
Because a settings file is a Python module, the following apply:
|
Because a settings file is a Python module, the following apply:
|
||||||
|
|
||||||
* It shouldn't have Python syntax errors.
|
* It doesn't allow for Python syntax errors.
|
||||||
* It can assign settings dynamically using normal Python syntax.
|
* It can assign settings dynamically using normal Python syntax.
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ When you use Django, you have to tell it which settings you're using. Do this
|
|||||||
by using an environment variable, ``DJANGO_SETTINGS_MODULE``.
|
by using an environment variable, ``DJANGO_SETTINGS_MODULE``.
|
||||||
|
|
||||||
The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax, e.g.
|
The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax, e.g.
|
||||||
``"myproject.settings"``. Note that the settings module should be on the
|
``mysite.settings``. Note that the settings module should be on the
|
||||||
Python `import search path`_.
|
Python `import search path`_.
|
||||||
|
|
||||||
.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
|
.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
|
||||||
@ -47,17 +47,17 @@ once, or explicitly pass in the settings module each time you run the utility.
|
|||||||
|
|
||||||
Example (Unix Bash shell)::
|
Example (Unix Bash shell)::
|
||||||
|
|
||||||
export DJANGO_SETTINGS_MODULE=myproject.settings
|
export DJANGO_SETTINGS_MODULE=mysite.settings
|
||||||
django-admin.py runserver
|
django-admin.py runserver
|
||||||
|
|
||||||
Example (Windows shell)::
|
Example (Windows shell)::
|
||||||
|
|
||||||
set DJANGO_SETTINGS_MODULE=myproject.settings
|
set DJANGO_SETTINGS_MODULE=mysite.settings
|
||||||
django-admin.py runserver
|
django-admin.py runserver
|
||||||
|
|
||||||
Use the ``--settings`` command-line argument to specify the settings manually::
|
Use the ``--settings`` command-line argument to specify the settings manually::
|
||||||
|
|
||||||
django-admin.py runserver --settings=myproject.settings
|
django-admin.py runserver --settings=mysite.settings
|
||||||
|
|
||||||
.. _django-admin.py: http://www.djangoproject.com/documentation/django_admin/
|
.. _django-admin.py: http://www.djangoproject.com/documentation/django_admin/
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ settings file to use. Do that with ``SetEnv``::
|
|||||||
<Location "/mysite/">
|
<Location "/mysite/">
|
||||||
SetHandler python-program
|
SetHandler python-program
|
||||||
PythonHandler django.core.handlers.modpython
|
PythonHandler django.core.handlers.modpython
|
||||||
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
|
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
Read the `Django mod_python documentation`_ for more information.
|
Read the `Django mod_python documentation`_ for more information.
|
||||||
@ -118,6 +118,8 @@ In your Django apps, use settings by importing them from
|
|||||||
Note that your code should *not* import from either ``global_settings`` or
|
Note that your code should *not* import from either ``global_settings`` or
|
||||||
your own settings file. ``django.conf.settings`` abstracts the concepts of
|
your own settings file. ``django.conf.settings`` abstracts the concepts of
|
||||||
default settings and site-specific settings; it presents a single interface.
|
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.
|
||||||
|
|
||||||
Altering settings at runtime
|
Altering settings at runtime
|
||||||
============================
|
============================
|
||||||
@ -640,8 +642,8 @@ error page will display a detailed report for any ``TemplateSyntaxError``. This
|
|||||||
report contains the relevant snippet of the template, with the appropriate line
|
report contains the relevant snippet of the template, with the appropriate line
|
||||||
highlighted.
|
highlighted.
|
||||||
|
|
||||||
Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so you'll
|
Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so
|
||||||
want to set that to take advantage of this setting.
|
you'll want to set that to take advantage of this setting.
|
||||||
|
|
||||||
See also DEBUG.
|
See also DEBUG.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user