Created
October 18, 2012 16:11
-
-
Save lsemel/3912866 to your computer and use it in GitHub Desktop.
Add to .bash_profile to automatically activate a virtualenv matching the directory you cd into
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
function cd { | |
builtin cd "$@" | |
dirname=${PWD##*/} | |
if [ $dirname ] ; then | |
venv="/var/www/virtualenvs/"${dirname} | |
if [ -d $venv ] ; then | |
source ${venv}/bin/activate | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment