Skip to main content

Handle .env files

Project description

Python Dot Env Handler

Build Status

Based on https://github.com/pedroburon/dotenv

Shell Command and Library to write and read .env like files.

.env files are commonly used with Procfile-based apps.

Usage

Shell

Inspect file

$ ndenv
FOO: bar
Bar: baz

Get value for key

$ ndenv FOO
FOO: bar

Set value for key

$ ndenv FOO baz
FOO: baz

As a library

>>> from ndenv import NDenv
>>> ndenv = NDenv('/path/to/.env')
>>> print ndenv
{"FOO": "bar", "Bar": "baz"}
>>> ndenv['FOO']
"bar"
>>> ndenv['FOO'] = "baz"
>>> ndenv['FOO']
"baz"
>>> del ndenv['FOO']
>>> print ndenv
{"Bar": "baz"}

Every action is persisted.

Use with Django

# add this to manage.py above `execute_from_command_line(sys.argv)`

from ndenv import NDenv
ndenv = NDenv(os.path.join(os.path.dirname(__file__), '.env'))
os.environ.update(ndenv)

Project details


Release history Release notifications

This version

0.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ndenv, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size ndenv-0.0.7-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size ndenv-0.0.7.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page