Created
January 26, 2013 20:27
-
-
Save emperorcezar/4644435 to your computer and use it in GitHub Desktop.
bash function to start development on a project.
This file contains hidden or 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
| startdev() { | |
| # Try installing the requirements | |
| # Only check this directory or the one above it | |
| if [ -e ./requirements.txt ]; then | |
| ${VIRTUAL_ENV}/bin/pip install -r ./requirements.txt || true | |
| elif [ -e ../requirements.txt ]; then | |
| ${VIRTUAL_ENV}/bin/pip install -r ../requirements.txt || true | |
| fi | |
| MANAGE=`find . -name 'manage.py'` | |
| NUM_RESULTS=$(echo $MANAGE | wc -l) | |
| if [ $NUM_RESULTS -eq 1 ]; then | |
| MANAGE_DIR=$(dirname $MANAGE) | |
| echo $MANAGE_DIR | |
| DEBUG=True ${VIRTUAL_ENV}/bin/python ${MANAGE_DIR}/manage.py syncdb | |
| DEBUG=True ${VIRTUAL_ENV}/bin/python ${MANAGE_DIR}/manage.py runserver_plus | |
| else | |
| echo "Found too many manage.py. exiting..." | |
| return 1 | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment