Skip to content

Commit 956d69e

Browse files
committed
docs: clarify what load_dotenv() does in README
1 parent 16f2bda commit 956d69e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ 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+
- Look for a `.env` file in the same directory as the Python script (or higher up the directory tree).
50+
- Read each key-value pair and add it to `os.environ`.
51+
- **Not override** an environment variable that is already set, unless you explicitly pass `override=True`.
4652

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

0 commit comments

Comments
 (0)