Created
November 25, 2015 11:00
-
-
Save sigilioso/03ae9b419440b213a830 to your computer and use it in GitHub Desktop.
Environment variables for python virtualenvs with virtualenvwrapper
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
#!/bin/bash | |
# This hook is run after this virtualenv is activated. | |
# To be in $VIRTUALENV_HOME/bin/postactivate | |
if [[ -n $DJANGO_SETTINGS_MODULE ]] | |
then | |
export DJANGO_SETTINGS_MODULE_BACKUP=$DJANGO_SETTINGS_MODULE | |
fi | |
export DJANGO_SETTINGS_MODULE=YOUR.VALUE |
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
#!/bin/bash | |
# This hook is run after this virtualenv is deactivated. | |
# To be in $VIRTUALENV_HOME/bin/postdeactivate | |
if [[ -n $DJANGO_SETTINGS_MODULE_BACKUP ]] | |
then | |
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE_BACKUP | |
unset DJANGO_SETTINGS_MODULE_BACKUP | |
else | |
unset DJANGO_SETTINGS_MODULE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment