From: Guillaume Pellerin Date: Thu, 12 May 2016 15:09:55 +0000 (+0200) Subject: fix media access rights (should close #107) X-Git-Tag: 1.6.2^2~26 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=c5caa3673950ae8d5e6c6d75fce3b305ffe40436;p=telemeta.git fix media access rights (should close #107) --- diff --git a/app/scripts/app.sh b/app/scripts/app.sh index 1f2568a6..43dec020 100644 --- a/app/scripts/app.sh +++ b/app/scripts/app.sh @@ -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