Skip to content

Commit 4d5ba26

Browse files
committed
Clarify that system variables get higher precedence
This is the expected behaviour, it's just the documentation that needed to be fixed.
1 parent cf59260 commit 4d5ba26

1 file changed

Lines changed: 14 additions & 21 deletions

File tree

README.rst

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,6 @@ production using `12-factor <http://12factor.net/>`__ principles.
3030
Usages
3131
======
3232

33-
``.env`` is a simple text file. With each environment variables listed
34-
per line, in the format of ``KEY="Value"``
35-
36-
::
37-
38-
SECRET_KEY="your_secret_key"
39-
DATABASE_PASSWORD="your_database_password"
40-
...
41-
42-
If you want to be really fancy with your env file you can do comments
43-
(below is a valid env file)
44-
45-
.. code:: shell
46-
47-
# I am a comment and that is OK
48-
SOME_VAR=someval
49-
FOO=BAR
50-
5133
Assuming you have created the ``.env`` file along-side your settings
5234
module.
5335

@@ -68,9 +50,9 @@ Add the following code to your ``settings.py``
6850
dotenv_path = join(dirname(__file__), '.env')
6951
load_dotenv(dotenv_path)
7052
71-
Now, you can access the variables either from existing environment
72-
variable or loaded from ``.env`` file. ``.env`` file gets higher
73-
precedence, and it's advised not to include it in version control.
53+
Now, you can access the variables either from system environment
54+
variable or loaded from ``.env`` file. **System environment variables
55+
gets higher precedence** and it's advised not to include it in version control.
7456

7557
.. code:: python
7658
@@ -79,6 +61,17 @@ precedence, and it's advised not to include it in version control.
7961
SECRET_KEY = os.environ.get("SECRET_KEY")
8062
DATABASE_PASSWORD = os.environ.get("DATABASE_PASSWORD")
8163
64+
65+
``.env`` is a simple text file. With each environment variables listed
66+
per line, in the format of ``KEY="Value"``, lines starting with `#` is
67+
ignored.
68+
69+
.. code:: shell
70+
71+
SOME_VAR=someval
72+
# I am a comment and that is OK
73+
FOO="BAR"
74+
8275
Django
8376
------
8477

0 commit comments

Comments
 (0)