Commit 12f053ef authored by Kenneth Reitz's avatar Kenneth Reitz

remove almost all django support

parent 35ee2f60
...@@ -159,7 +159,7 @@ pip install --use-mirrors -r requirements.txt --exists-action=w --src=./.heroku/ ...@@ -159,7 +159,7 @@ pip install --use-mirrors -r requirements.txt --exists-action=w --src=./.heroku/
# See [`bin/steps/django`](django.html). # See [`bin/steps/django`](django.html).
if [ "$NAME" = "Python/Django" ]; then if [ "$NAME" = "Python/Django" ]; then
source $BIN_DIR/steps/django/init source $BIN_DIR/steps/django
fi fi
# Make Virtualenv's paths relative for portability. # Make Virtualenv's paths relative for portability.
......
...@@ -19,46 +19,11 @@ if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then ...@@ -19,46 +19,11 @@ if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then
exit 1 exit 1
fi fi
# If only `setup.py`, assume that the app is not Django. # `Python/Django` if `**/settings.py` is present.
if [ ! -f $BUILD_DIR/requirements.txt ]; then
echo Python
exit 0
fi
# `Python/Django` if `**/settings.py` is present and `django` exists in
# `requirements.txt`.
# #
# Otherwise, `Python`. # Otherwise, `Python`.
array=""
list_requirements() {
IFS_BAK=$IFS
IFS="
"
requirement_file=$1
reqs=$(cat $requirement_file)
for req in $reqs; do
if [[ $req == -r* ]]; then
new_req=$(echo $req | cut -d" " -f2)
if [[ $new_req == $1 ]]; then
continue
fi
directory=$(dirname $requirement_file)
if [[ ! $array == *$directory/$new_req* ]]; then
list_requirements "$directory/$new_req"
fi
array="$array $directory/$new_req"
else
echo $req;
fi
done
IFS=$IFS_BAK
IFS_BAK=
}
SETTINGS_FILE=$(find $BUILD_DIR/. -maxdepth 2 -type f -name 'settings.py' | head -1)
SETTINGS_FILE=$(find $BUILD_DIR/. -maxdepth 3 -type f -name 'settings.py' | head -1)
[ -n "$SETTINGS_FILE" ] && ( list_requirements $BUILD_DIR/requirements.txt | grep -Fiq "django" ) && echo Python/Django || echo Python [ -n "$SETTINGS_FILE" ] && echo Python/Django || echo Python
#!/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
#!/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
#!/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
#!/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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment