# direnv file

# This is just a bash script.
# https://direnv.net/man/direnv-stdlib.1.html
# https://github.com/direnv/direnv/wiki

# Activate the virtualenv
# This simply replicates what venv/bin/activate does.
# See, https://docs.python.org/3/library/venv.html#module-venv

if [[ -d "venv/bin" ]]; then
    # The path to the virtualenv should be absolute. If you use ipython
    # for the Django shell it will raise an error if the path is relative.
    # https://github.com/ipython/ipython/issues/13268
    # https://github.com/direnv/direnv/issues/304
    export VIRTUAL_ENV=`pwd`/venv
    PATH_add "venv/bin"
fi

# Set environment variables from .env. We're using a conditional
# in case an older version of direnv is used. In recent releases
# there is the stdlib function dotenv_if_exists

if [[ -f ".env" ]]; then
    dotenv
fi
