Created
January 20, 2020 15:29
-
-
Save logerrors/7032fd9eab25ee5b4e6059f4aa56b828 to your computer and use it in GitHub Desktop.
python-dotenv手动加载环境变量
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from dotenv import load_dotenv | |
dotenv_path = os.path.join(os.path.dirname(__file__), '.env') | |
if os.path.exists(dotenv_path): | |
load_dotenv(dotenv_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment