Skip to content

Instantly share code, notes, and snippets.

@logerrors
Created January 20, 2020 15:29
Show Gist options
  • Save logerrors/7032fd9eab25ee5b4e6059f4aa56b828 to your computer and use it in GitHub Desktop.
Save logerrors/7032fd9eab25ee5b4e6059f4aa56b828 to your computer and use it in GitHub Desktop.
python-dotenv手动加载环境变量
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