Skip to content

Secret(s) Guide @ Coding:

Store project secrets safely with a .env and the dotenv library. Follow the guide below:

Example Python Code to get your Token from an .env File:

import os
from dotenv import load_dotenv 

load_dotenv()

token = os.environ["Token"]

Never put your .env in your Git Repo. Here is how to avoid it:

  1. Create an .gitignore (Critcal Step otherwise your secrets will be revealed!)
  2. Add .env to the file.
  3. Commit it.
  4. Add your tokens to your .env after the commit.
.env

Tip

IndiSpark has a variety of FREE code examples. One Example is on how to use this system. Click Here