Environment Variables on different deployment stages

Python-dotenv reads key-value pairs from a .env file and can set them as environment variables. Maybe the best way to handle environment variables → great video

Installation via conda or pip:

conda install python-dotenv

## 2. Set up Open AI Configuration

Create a new `dev.env` file in the root folder and paste the following content as string value:

ACCESS_TOKEN=<your_token> PAGE_ID=<your_page_id>

Get local variables from a python file:

from dotenv import load_dotenv
import os
# set environment variables from file, only if:
# 1) dev.env file exists
# 2) and the environment variables does not already exis
load_dotenv("dev.env", override=False)
ACCESS_TOKEN = os.getenv("ACCESS_TOKEN")

<aside> 💡 Ask GPT to manage different environment configurations across various development stages and your local machine!!! According to this thread there must be ways to handle this problem with python classes.

</aside>