Skip to content

Commit aaa00ad

Browse files
adamchainzblueyed
authored andcommitted
Improve 'configuring' docs (#642)
* Improve 'configuring' docs Tidy wording and improve syntax highlighting - single backticks had been used in some places instead of double, giving italics rather than code highlighting. * clarify option and how precedence can be overridden
1 parent 7d5b2d9 commit aaa00ad

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

docs/configuring_django.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Example::
3030
$ pytest --ds=test_settings
3131

3232

33-
pytest.ini settings
34-
-------------------
33+
``pytest.ini`` settings
34+
-----------------------
3535

3636
Example contents of pytest.ini::
3737

@@ -41,20 +41,23 @@ Example contents of pytest.ini::
4141
Order of choosing settings
4242
--------------------------
4343

44-
When the command option `--ds`, the environment variable and the pytest.ini
45-
configuration is used at the same time, pytest-django will prefer using
46-
settings from the command line option `--ds`, then the environment variable and
47-
last the pytest.ini.
48-
You can use `addopts = --ds=yourtestsettings` in your pytest configuration
49-
to automatically add the `--ds` option.
44+
The order of precedence is, from highest to lowest:
45+
46+
* The command line option ``--ds``
47+
* The environment variable ``DJANGO_SETTINGS_MODULE``
48+
* The ``DJANGO_SETTINGS_MODULE`` option in the configuration file -
49+
``pytest.ini``, or other file that Pytest finds such as ``tox.ini``
50+
51+
If you want to use the highest precedence in the configuration file, you can
52+
use ``addopts = --ds=yourtestsettings``.
5053

5154
Using django-configurations
5255
---------------------------
5356

5457
There is support for using `django-configurations <https://pypi.python.org/pypi/django-configurations/>`_.
5558

56-
To do so configure the settings class using an environment variable, the --dc
57-
flag, or pytest.ini DJANGO_CONFIGURATION.
59+
To do so configure the settings class using an environment variable, the
60+
``--dc`` flag, or ``pytest.ini`` option ``DJANGO_CONFIGURATION``.
5861

5962
Environment Variable::
6063

@@ -65,7 +68,6 @@ Command Line Option::
6568

6669
$ pytest --dc=MySettings
6770

68-
6971
INI File Contents::
7072

7173
[pytest]

0 commit comments

Comments
 (0)