Skip to content

Instantly share code, notes, and snippets.

@alanthonyc
Created June 27, 2011 11:30
Show Gist options
  • Save alanthonyc/1048701 to your computer and use it in GitHub Desktop.
Save alanthonyc/1048701 to your computer and use it in GitHub Desktop.
.bashrc to auto activate a virtualenv
# 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