pip install python-decouple
API_KEY=your_api_key
DATABASE_PASSWORD=your_password
python
from decouple import Config
config = Config()
api_key = config('API_KEY')
database_password = config('DATABASE_PASSWORD')
python
from decouple import Config, UndefinedValueError
config = Config()
if config('API_KEY').exists():
api_key = config('API_KEY')
else:
raise UndefinedValueError('API_KEY is not provided in the configuration file')