Skip to content
Snippets Groups Projects
Commit e7495df1 authored by Noah Zoschke's avatar Noah Zoschke
Browse files

install bin/manage.py wrapper script for django, remove console process type

parent c2f4f929
No related branches found
No related tags found
No related merge requests found
......@@ -33,14 +33,15 @@ done
echo "-----> Preparing virtualenv version $(virtualenv --version)"
virtualenv --no-site-packages . | sed -u 's/^/ /'
echo "-----> Byte-compiling code"
find . -name "*.py" | xargs bin/python -m py_compile
#echo "-----> Byte-compiling code"
find . -name "*.py" | grep -v bin/manage.py | xargs bin/python -m py_compile
# if Django, inject psycopg and append settings
if [ "$NAME" = "Python/Django" ]; then
echo "-----> Django settings injection"
SETTINGS_FILE=$(ls **/settings.py | head -1)
PROJECT=$(dirname $SETTINGS_FILE)
echo " Injecting code into $SETTINGS_FILE to read from DATABASE_URL"
cat >>$SETTINGS_FILE <<EOF
......@@ -58,6 +59,14 @@ if os.environ.has_key('DATABASE_URL'):
'PORT': url.port,
}
EOF
echo "-----> Django script installation"
cat >bin/manage.py <<EOF
#!/bin/bash
BIN_DIR=\$(cd \$(dirname \$0); pwd)
python \$BIN_DIR/../$PROJECT/manage.py \$*
EOF
chmod +x bin/manage.py
fi
echo "-----> Installing dependencies using pip version $(bin/pip --version | awk '{print $2}')"
......
......@@ -26,5 +26,4 @@ addons:
default_process_types:
web: bin/python $PROJECT/manage.py runserver 0.0.0.0:\$PORT --noreload
console: bin/python $PROJECT/manage.py shell
EOF
\ No newline at end of file
EOF
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment