Skip to content

Instantly share code, notes, and snippets.

View brouse36's full-sized avatar

Brandon brouse36

  • Halliburton
View GitHub Profile
@staltz
staltz / _set_local_env_vars.py
Last active May 6, 2024 03:15
Call this from your Django settings file to import environment variables from '.env'. Useful if you use PyCharm and want an automatic solution to recognize your env variables.
import os
ENV_VARS_FILENAME = '.env'
def import_env_vars(project_root):
"""Imports some environment variables from a special .env file in the
project root directory.
"""
if len(project_root) > 0 and project_root[-1] != '/':