Source

django-environments / bin / djenvlib

Diff from to

bin/djenvlib

             done && \
         echo 2>&1 && echo ">>> Making documentation..." 2>&1 && makedocs && \
         echo 2>&1 && echo ">>> Collecting static files..." 2>&1 && \
-            djadmin collectstatic --link --noinput && \
+            deploy_static && \
         echo 2>&1 && echo ">>> Setting permissions..." 2>&1 && set_permissions.sh && \
         echo 2>&1 && echo ">>> Clearing cache..." 2>&1 && clearcache && \
         echo ">>> Restarting server..." 2>&1 && graceful && \
     echo 2>&1 && echo "Errors encountered - deploy aborted." 2>&1
 }
 
+# Perform collectstatic --link based on a clean static directory
+# to prevent conflicts. Revert's content of static directory if
+# $PROJECT_ROOT is a Mercurial repos.
+function deploy_static() {
+    local static_root=`get_django_setting STATIC_ROOT`
+    rm -rf $static_root/* && \
+        if [ -d $PROJECT_ROOT/.hg ]; then
+             hg revert $static_root
+        fi && \
+        djadmin collectstatic --link --noinput --verbosity=0
+}
+
 # XXX
 function bootstrapproject() {
     _verify_project_root || return 1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.