function virtualenv_paths --on-event virtualenv_did_activate:YOUR_VIRTUALENV # set pythonpath and settings module set -gx PYTHONPATH ~/YOUR_PROJECT set -gx DJANGO_SETTINGS_MODULE yourproject.settings.settings_dev # make manage.py usable from anywhere while the virtualenv is active function manage python ~/YOUR_PROJECT/manage.py $argv end # set up autocompletions function list_django_commands manage | python -c "import sys; print '\n'.join([c.replace(' ', '') for c in sys.stdin.read().split('Available subcommands')[1].split('\n') if c.startswith(' ')])" end complete -x -c manage -a "(list_django_commands)" end