Skip to content

Instantly share code, notes, and snippets.

@FerusAndBeyond
Created April 29, 2022 18:26
Show Gist options
  • Save FerusAndBeyond/ab45709af14bd6a06d39e0b3683338ee to your computer and use it in GitHub Desktop.
Save FerusAndBeyond/ab45709af14bd6a06d39e0b3683338ee to your computer and use it in GitHub Desktop.
env-variable part 2
from dotenv import load_dotenv
import os
# by default .env will be loaded
load_dotenv()
# if we had another file called .env2
# we could load it using
# load_dotenv(".env2")
# now we can use os.getenv as before:
print(os.getenv("VARIABLE1"))
# => "HELLO"
print(os.getenv("VARIABLE2"))
# => "WORLD"
print(os.getenv("VARIABLE3"))
# => "HELLO WORLD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment