Skip to main content
============
JSON Environ
============


.. image:: https://img.shields.io/pypi/v/json_environ.svg
:target: https://pypi.python.org/pypi/json_environ

.. image:: https://readthedocs.org/projects/json-environ/badge/?version=latest
:target: https://json-environ.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status



Utilize environment variables from JSON file to configure your Python application. Inspired from `django-environ`_.

.. _django-environ: https://github.com/joke2k/django-environ


* Free software: MIT license
* Documentation: https://json-environ.readthedocs.io.

=====
Quick Example
=====

Let's assume we have JSON file like::

{
"SECRET_KEY": "kminvupn=7dbw70e!#njo8qas2bx$tmw$nv1pt$g30&+f4(8c)",
"DEBUG": true,
"SSL": false,
"ALLOWED_HOSTS": [
"*"
],
"DATABASE": {
"NAME": "dbname",
"USER": "dbuser",
"PASSWORD": "dbsecret"
}
}

To use `JSON Environ` in a project::

import os

from json_environ import Environ

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
env_path = os.path.join(BASE_DIR, '.my_env.json')
env = Environ(path=env_path)

SECRET_KEY = env('SECRET_KEY', default="PT09PT0KVXNhZ2UKPT09PT0KClRvI")
DEBUG = env("DEBUG")
ALLOWED_HOSTS = env('ALLOWED_HOSTS')
if env('SSL', default=False) is True:
SECURE_SSL_REDIRECT = False

DATABASES = {
'default': {
'NAME': env("DATABASE:NAME", default="test"),
'USER': env("DATABASE:USER", default="lms"),
'PASSWORD': env("DATABASE:PASSWORD", default="123456"),
}
}

Credits
---------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage



=======
History
=======

0.1.0 (2017-10-09)
------------------

* First release on PyPI.

Metadata

Release files for json_environ 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json_environ 0.1.1
File Size Uploaded
json_environ-0.1.1.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json_environ 0.1.1
File Interpreter ABI Platform
json_environ-0.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 17.7 kB

Release files / json_environ-0.1.1.tar.gz

Download URL json_environ-0.1.1.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
559bceb2a7a58535ebd3236aec30f101adfcb0ee4ff151d9d8fb3853ded01437
BLAKE2b-256 checksum
How to use checksums
6f468686d58d32b3bfedcd0e3adad64d3c7fbb2aca24e2ccda83fb2fe44f7716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / json_environ-0.1.1-py2.py3-none-any.whl

Download URL json_environ-0.1.1-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c1d9be30ed7b63f9adb0aebe90e9d4b43318e440b343a2b3af300cbce8ee20df
BLAKE2b-256 checksum
How to use checksums
26a3d67043518e79697280af1a129038a1b6486e4bf55a3fa88d196564700194
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page