]> git.parisson.com Git - telemeta.git/commitdiff
fix media access rights (should close #107)
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 12 May 2016 15:09:55 +0000 (17:09 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 12 May 2016 15:09:55 +0000 (17:09 +0200)
app/scripts/app.sh

index 1f2568a6220aa9f0fb83e03f0982b4907d6d362e..43dec020c0d65c6ae97c7b25ddfedb9a0bedbd2c 100644 (file)
@@ -34,12 +34,21 @@ python $manage collectstatic --noinput
 python $manage telemeta-create-admin-user
 python $manage telemeta-create-boilerplate
 
-if [ $DEBUG = "False" ]; then
+# fix media access rights
+chown www-data:www-data $media
+for dir in $(ls $media); do
+    if [ ! $(stat -c %U $media/$dir) = 'www-data' ]; then
+        chown www-data:www-data $media/$dir
+    fi
+done
+
+# update haystack index in prod
+if [ "$DEBUG" = "False" ]; then
     python $manage update_index --workers $processes &
 fi
 
-
-if [ $1 = "--runserver" ]; then
+# choose dev or prod mode
+if [ "$1" = "--runserver" ]; then
     python $manage runserver_plus 0.0.0.0:8000
 else
     # static files auto update