Created
June 27, 2011 11:30
-
-
Save alanthonyc/1048701 to your computer and use it in GitHub Desktop.
.bashrc to auto activate a virtualenv
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
# from kencochrane.net | |
emacs /opt/django/.bashrc | |
# | |
# User specific aliases and functions | |
has_virtualenv() { | |
if [ -e .venv ]; then | |
deactivate >/dev/null 2>&1 | |
source bin/activate | |
fi | |
} | |
venv_cd () { | |
cd "$@" && has_virtualenv | |
} | |
alias cd="venv_cd" | |
#end of changes | |
# source the file to get new changes in active shell | |
source /opt/django/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment