Skip to content

Instantly share code, notes, and snippets.

@davesque
Created October 25, 2012 18:05
Show Gist options
  • Save davesque/3954372 to your computer and use it in GitHub Desktop.
Save davesque/3954372 to your computer and use it in GitHub Desktop.
Navigates to django site package in a virtualenv
function d {
if [[ $1 == "-f" ]]; then
if [[ -n $2 ]]; then
pushd $WORKON_HOME/$2/src/django-fusionbox
else
__d_help
fi
elif [[ -n $1 ]]; then
pushd $(__d_get_site_packages_dir $1)/django
else
__d_help
fi
}
function __d_get_site_packages_dir {
$WORKON_HOME/$1/bin/python -c "import distutils; print(distutils.sysconfig.get_python_lib())"
}
function __d_help {
cat <<HELP
Usage: d [-f] <virtualenv>
Navigates to the django site package directory for the specified
virtualenv. If the -f option is specified, navigates to the
django-fusionbox package directory for that virtualenv.
HELP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment