From a21dbc2da1685578dcb4d3e79b9ce3f0a3719e27 Mon Sep 17 00:00:00 2001
From: Kenneth Reitz <me@kennethreitz.com>
Date: Tue, 29 May 2012 21:08:34 -0400
Subject: [PATCH] run collectstatic

---
 bin/steps/django/collectstatic | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/bin/steps/django/collectstatic b/bin/steps/django/collectstatic
index 40531a2c..3ecbbbcc 100755
--- a/bin/steps/django/collectstatic
+++ b/bin/steps/django/collectstatic
@@ -2,13 +2,25 @@
 
 set +e
 
-# Compile assets.
-echo "-----> Collecting static files"
-python $PROJECT/manage.py collectstatic --noinput  | indent
+# Check if collectstatic is configured.
+python $PROJECT/manage.py collectstatic --help &> /dev/null && RUN_COLLECTSTATIC=true
 
-[ $? -ne 0 ] && {
-  echo " !     Error running manage.py collectstatic. More info:"
-  echo " !     http://devcenter.heroku.com/articles/django-assets"
-}
+# Don't raise errors if SILENCE_COLLECTSTATIC is set.
+if [ ! "$SILENCE_COLLECTSTATIC" ]]; then
+    set -e
+fi
+
+# Compile assets if collectstatic appears to be .
+if [ "$RUN_COLLECTSTATIC" ]; then
+    echo "-----> Collecting static files"
+    python $PROJECT/manage.py collectstatic --noinput  | indent
+
+    [ $? -ne 0 ] && {
+        echo " !     Error running manage.py collectstatic. More info:"
+        echo "       http://devcenter.heroku.com/articles/django-assets"
+    }
+else
+    echo " !     Django collecstatic is not configured. Learn more:"
+    echo "       http://devcenter.heroku.com/articles/django-assets"
+fi
 
-set -e
\ No newline at end of file
-- 
GitLab