mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 14:50:16 +00:00
@@ -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
|
||||
-------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
More documentation for ``.env`` files
|
||||
Reference in New Issue
Block a user