Installation
Using pip
python -m pip install --user virtualenv
Create folder to local python packages
python -m virtualenv venv
source venv/bin/activate
Install colorama package
pip install colorama
Call colorama
from pip._vendor.colorama import init, Fore
Install python-dotenv package
pip install python-dotenv
Usage
create .env file
DATABASE_CONFIG=my_database_config
In settings.py
from dotenv import load_dotenv
import os
# load all env variables from .env file
load_dotenv()
# print out the value
print(os.getenv('DATABASE_CONFIG'))
python --version
pip --version # */venv/lib/python3.8/site-packages/pip (python 3.8)
python3.8 settings.py
Top comments (0)