mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
install bin/manage.py wrapper script for django, remove console process type
This commit is contained in:
+11
-2
@@ -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}')"
|
||||
|
||||
+1
-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
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user