Skip to content

Instantly share code, notes, and snippets.

@gilsondev
Created September 1, 2012 21:32
Show Gist options
  • Save gilsondev/3588030 to your computer and use it in GitHub Desktop.
Save gilsondev/3588030 to your computer and use it in GitHub Desktop.
Cria variável de ambiente que aponta para o caminho da pasta do projeto ao ativar o ambiente com virtualenvwrapper.
# Plus: Creating alias for manage.py of django projects (with manage.py in root)
alias manage='$PROJECT_PATH/manage.py'
#!/bin/bash
# This hook is run after every virtualenv is activated.
# Basically create a environment variable which return absolute path in the project.
#
# PROJECT_HOME = /home/user/Devel
# PROJECT_PATH = /home/user/Devel/your_project
if [ -e $VIRTUALENVWRAPPER_PROJECT_FILENAME ]; then
FILE_PATH=$(find $VIRTUAL_ENV -name $VIRTUALENVWRAPPER_PROJECT_FILENAME)
export PROJECT_PATH=$(cat $FILE_PATH)
fi
#!/bin/bash
# This hook is run after a new project is activated.
# Basically create a environment variable which return absolute path in the project.
#
# PROJECT_HOME = /home/user/Devel
# PROJECT_PATH = /home/user/Devel/your_project
if [ -e $VIRTUAL_ENV ]; then
FILE_PATH=$(find $VIRTUAL_ENV -name $VIRTUALENVWRAPPER_PROJECT_FILENAME)
export PROJECT_PATH=$(cat $FILE_PATH)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment