mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
remove almost all django support
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Syntax sugar.
|
||||
indent() {
|
||||
RE="s/^/ /"
|
||||
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
|
||||
}
|
||||
|
||||
SETTINGS_FILE=$(find . -maxdepth 3 -type f -name 'settings.py' | head -1)
|
||||
PROJECT=$(dirname $SETTINGS_FILE)
|
||||
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
|
||||
MANAGE_FILE=${MANAGE_FILE:2}
|
||||
|
||||
|
||||
if [ ! "$DISABLE_COLLECTSTATIC" ]; then
|
||||
set +e
|
||||
|
||||
# Check if collectstatic is configured properly.
|
||||
python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true
|
||||
|
||||
# Compile assets if collectstatic appears to be kosher.
|
||||
if [ "$RUN_COLLECTSTATIC" ]; then
|
||||
|
||||
echo "-----> Collecting static files"
|
||||
python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
|
||||
|
||||
[ $? -ne 0 ] && {
|
||||
echo " ! Error running manage.py collectstatic. More info:"
|
||||
echo " http://devcenter.heroku.com/articles/django-assets"
|
||||
}
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
|
||||
fi
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set +e
|
||||
|
||||
# Syntax sugar.
|
||||
indent() {
|
||||
RE="s/^/ /"
|
||||
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
|
||||
}
|
||||
|
||||
|
||||
# Check if collectstatic is configured properly.
|
||||
python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true
|
||||
|
||||
# Compile assets if collectstatic appears to be kosher.
|
||||
if [ "$RUN_COLLECTSTATIC" ]; then
|
||||
|
||||
echo "-----> Collecting static files"
|
||||
python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
|
||||
|
||||
[ $? -ne 0 ] && {
|
||||
echo " ! Error running manage.py collectstatic. More info:"
|
||||
echo " http://devcenter.heroku.com/articles/django-assets"
|
||||
}
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SETTINGS_FILE=$(find . -maxdepth 3 -type f -name 'settings.py' | head -1)
|
||||
PROJECT=$(dirname $SETTINGS_FILE)
|
||||
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
|
||||
MANAGE_FILE=${MANAGE_FILE:2}
|
||||
|
||||
if [ "$FRESH_APP" ]; then
|
||||
# Legacy Django injection for existing applications.
|
||||
touch .heroku/injection_disabled
|
||||
fi
|
||||
|
||||
# Disable injection for new applications.
|
||||
if [ -f .heroku/injection_disabled ]; then
|
||||
DISABLE_INJECTION=1
|
||||
fi
|
||||
|
||||
if [ -f .heroku/collectstatic_disabled ]; then
|
||||
DISABLE_COLLECTSTATIC=1
|
||||
fi
|
||||
|
||||
export SETTINGS_FILE MANAGE_FILE PROJECT DISABLE_INJECTION
|
||||
|
||||
if [ ! "$DISABLE_INJECTION" ]; then
|
||||
# Legacy Django injection for existing applications.
|
||||
source $BIN_DIR/steps/django/injection
|
||||
fi
|
||||
|
||||
if [ ! "$DISABLE_COLLECTSTATIC" ]; then
|
||||
source $BIN_DIR/steps/django/collectstatic
|
||||
fi
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script serves as the Django injection build step of the
|
||||
# [**Python Buildpack**](https://github.com/heroku/heroku-buildpack-python)
|
||||
# compiler.
|
||||
#
|
||||
# A [buildpack](http://devcenter.heroku.com/articles/buildpacks) is an
|
||||
# adapter between a Python application and Heroku's runtime.
|
||||
#
|
||||
# This script is invoked by [`bin/compile`](/).
|
||||
|
||||
# ## Sanity Checks
|
||||
#
|
||||
|
||||
# Syntax sugar.
|
||||
indent() {
|
||||
RE="s/^/ /"
|
||||
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
|
||||
}
|
||||
|
||||
echo "-----> Injecting legacy Django settings..."
|
||||
echo " ! WARNING: Settings injection will be fully deprecated on January 1, 2013. More info:"
|
||||
echo " ! https://devcenter.heroku.com/articles/django-injection "
|
||||
|
||||
|
||||
echo "-----> Installing dj-database-url..."
|
||||
pip install --use-mirrors 'dj-database-url>=0.2.0' | indent
|
||||
|
||||
SETTINGS_FILE=$(find . -maxdepth 2 -type f -name 'settings.py' | head -1)
|
||||
PROJECT=$(dirname $SETTINGS_FILE)
|
||||
|
||||
echo "Injecting code into $SETTINGS_FILE to read from DATABASE_URL" | indent
|
||||
|
||||
cat >>$SETTINGS_FILE <<EOF
|
||||
|
||||
import dj_database_url
|
||||
|
||||
if 'DATABASES' not in locals():
|
||||
DATABASES = {}
|
||||
|
||||
if not 'default' in DATABASES:
|
||||
DATABASES['default'] = {}
|
||||
|
||||
DATABASES['default'].update(dj_database_url.config(default='postgres://'))
|
||||
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user