Files
heroku-buildpack-python/bin/steps/django/collectstatic
T
2012-05-31 02:35:33 -04:00

31 lines
835 B
Bash
Executable File

#!/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
echo "-----> Collecting static files"
# Compile assets if collectstatic appears to be kosher.
if [ "$RUN_COLLECTSTATIC" ]; then
python $MANAGE_FILE collectstatic --noinput | sed '/^Copying/d;/^$/d' | indent
[ $? -ne 0 ] && {
echo " ! Error running manage.py collectstatic. More info:"
echo " http://devcenter.heroku.com/articles/django-assets"
exit 1
}
else
echo " Django collecstatic is not configured. Learn more:"
echo " http://devcenter.heroku.com/articles/django-assets"
fi
echo