Skip to content

Commit 9f722ce

Browse files
authored
docs: clarify what load_dotenv() does in README (#575)
* docs: clarify what load_dotenv() does in README * docs: clarify what load_dotenv() does in README
1 parent a2bc2b3 commit 9f722ce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,20 @@ configurable via the environment:
3636
```python
3737
from dotenv import load_dotenv
3838

39-
load_dotenv() # take environment variables
39+
load_dotenv() # reads variables from a .env file and sets them in os.environ
40+
```
41+
4042

4143
# Code of your application, which uses environment variables (e.g. from `os.environ` or
4244
# `os.getenv`) as if they came from the actual environment.
43-
```
4445

45-
By default, `load_dotenv` doesn't override existing environment variables and looks for a `.env` file in same directory as python script or searches for it incrementally higher up.
46+
47+
By default, `load_dotenv()` will:
48+
49+
50+
- Look for a `.env` file in the same directory as the Python script (or higher up the directory tree).
51+
- Read each key-value pair and add it to `os.environ`.
52+
- **Not override** an environment variable that is already set, unless you explicitly pass `override=True`.
4653

4754
To configure the development environment, add a `.env` in the root directory of your
4855
project:

0 commit comments

Comments
 (0)