Skip to content

Commit a883ef5

Browse files
authored
Merge pull request #4100 from timhughes/dotenv_docs
Dotenv docs
2 parents 2aa8775 + 1fcb1b5 commit a883ef5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/advanced.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,21 @@ If a ``.env`` file is present in your project, ``$ pipenv shell`` and ``$ pipenv
344344
>>> os.environ['HELLO']
345345
'WORLD'
346346

347+
Shell like variable expansion is available in ``.env`` files using `${VARNAME}` syntax.::
348+
349+
$ cat .env
350+
CONFIG_PATH=${HOME}/.config/foo
351+
352+
$ pipenv run python
353+
Loading .env environment variables…
354+
Python 3.7.6 (default, Dec 19 2019, 22:52:49)
355+
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
356+
Type "help", "copyright", "credits" or "license" for more information.
357+
>>> import os
358+
>>> os.environ['CONFIG_PATH']
359+
'/home/kennethreitz/.config/foo'
360+
361+
347362
This is very useful for keeping production credentials out of your codebase.
348363
We do not recommend committing ``.env`` files into source control!
349364

@@ -355,6 +370,8 @@ To prevent pipenv from loading the ``.env`` file, set the ``PIPENV_DONT_LOAD_ENV
355370

356371
$ PIPENV_DONT_LOAD_ENV=1 pipenv shell
357372

373+
See `theskumar/python-dotenv <https://github.com/theskumar/python-dotenv>`_ for more information on ``.env`` files.
374+
358375
☤ Custom Script Shortcuts
359376
-------------------------
360377

news/4100.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
More documentation for ``.env`` files

0 commit comments

Comments
 (0)