python-dotenv
tags :
Python Apps #
Reads key-value pairs from a .env file and can set them as environment variables. It helps in developing applications following the 12 Factor App Principles..
Variables .env in the root of the project directly will loaded and set as env variables.
Installation and configuring it #
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv() # take environment variables from .env.
# Code of your application, which uses environment variables (e.g. from `os.environ` or
# `os.getenv`) as if they came from the actual environment.