Skip to content

Commit

Permalink
Merge pull request #4100 from timhughes/dotenv_docs
Browse files Browse the repository at this point in the history
Dotenv docs
  • Loading branch information
frostming committed Mar 26, 2020
2 parents 2aa8775 + 1fcb1b5 commit a883ef5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/advanced.rst
Expand Up @@ -344,6 +344,21 @@ If a ``.env`` file is present in your project, ``$ pipenv shell`` and ``$ pipenv
>>> os.environ['HELLO']
'WORLD'

Shell like variable expansion is available in ``.env`` files using `${VARNAME}` syntax.::

$ cat .env
CONFIG_PATH=${HOME}/.config/foo

$ pipenv run python
Loading .env environment variables…
Python 3.7.6 (default, Dec 19 2019, 22:52:49)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['CONFIG_PATH']
'/home/kennethreitz/.config/foo'


This is very useful for keeping production credentials out of your codebase.
We do not recommend committing ``.env`` files into source control!

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

$ PIPENV_DONT_LOAD_ENV=1 pipenv shell

See `theskumar/python-dotenv <https://github.com/theskumar/python-dotenv>`_ for more information on ``.env`` files.

☤ Custom Script Shortcuts
-------------------------

Expand Down
1 change: 1 addition & 0 deletions news/4100.doc.rst
@@ -0,0 +1 @@
More documentation for ``.env`` files

0 comments on commit a883ef5

Please sign in to comment.