https://github.com/sloria/read_env
reads .env files
https://github.com/sloria/read_env
environment-variables python python-2 python-3 twelve-factor
Last synced: 8 months ago
JSON representation
reads .env files
- Host: GitHub
- URL: https://github.com/sloria/read_env
- Owner: sloria
- License: mit
- Archived: true
- Created: 2016-04-30T14:07:23.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-07-19T23:36:34.000Z (almost 9 years ago)
- Last Synced: 2025-01-20T22:09:31.263Z (over 1 year ago)
- Topics: environment-variables, python, python-2, python-3, twelve-factor
- Language: Python
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
********
read_env
********
.. image:: https://badge.fury.io/py/read_env.svg
:target: http://badge.fury.io/py/read_env
:alt: Latest version
.. image:: https://travis-ci.org/sloria/read_env.svg?branch=master
:target: https://travis-ci.org/sloria/read_env
:alt: Travis-CI
read_env reads .env.
Install
-------
::
pip install read_env
Usage
-----
Add variables to a ``.env`` file in your project.
.. code-block:: bash
# myapp/.env
DEBUG=true
PORT=5000
Call ``read_env`` to add the variables to ``os.environ``.
.. code-block:: python
# myapp/env.py
import os
from read_env import read_env
read_env()
assert os.environ['DEBUG'] == 'true'
assert int(os.environ['PORT']) == 5000
Changelog
---------
1.1.0 (2016-05-01)
++++++++++++++++++
* Add ``recurse`` parameter (defaults to ``True``).
* If ``.env`` file doesn't exist at given ``path``, recurse up the directory tree (by default).
1.0.0 (2016-04-30)
++++++++++++++++++
* First PyPI release.
Related Projects
----------------
Check out `environs `_ for parsing environment variables.
License
-------
MIT