Merge pull request #4100 from timhughes/dotenv_docs

Dotenv docs
This commit is contained in:
Frost Ming
2020-03-26 10:59:48 +08:00
committed by GitHub
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -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!
@@ -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
-------------------------
+1
View File
@@ -0,0 +1 @@
More documentation for ``.env`` files