Commit 44a146d7 authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE

MEDIA_ROOT is needed

parent b02c5ec8
......@@ -4,22 +4,18 @@ cd /code
source resources/tool_shed.sh
MEDIA_ROOT_DIR=$(python manage.py shell -c "from django.conf import settings; print(settings.MEDIA_ROOT)" | grep -v django.db.backends)
msg_info "Creating media root at $MEDIA_ROOT_DIR"
if [ "$MEDIA_ROOT_DIR" != "" ]; then
mkdir -p $MEDIA_ROOT_DIR
chmod 777 $MEDIA_ROOT_DIR
else
msg_warning "settings.MEDIA_ROOT missing, passed"
fi
if [ "$1" == "test" ]; then
msg_info "Running tests"
pip install coverage
cp viralhostrange/settings.example.ini viralhostrange/settings.ini || exit 2
MEDIA_ROOT_DIR=$(python manage.py shell -c "from django.conf import settings; print(settings.MEDIA_ROOT)" | grep -v django.db.backends)
mkdir -p $MEDIA_ROOT_DIR
chmod 777 $MEDIA_ROOT_DIR
python manage.py collectstatic --noinput
python manage.py compilemessages || exit 6
coverage run --source='.' manage.py test --failfast || exit 3
coverage run --source='.' manage.py test || exit 3
coverage report --skip-covered
coverage html -d persistent_volume/htmlcov
exit 0
......@@ -87,6 +83,15 @@ else
msg_warning "csscompressor missing, passed"
fi
MEDIA_ROOT_DIR=$(python manage.py shell -c "from django.conf import settings; print(settings.MEDIA_ROOT)" | grep -v django.db.backends)
msg_info "Creating media root at $MEDIA_ROOT_DIR"
if [ "$MEDIA_ROOT_DIR" != "" ]; then
mkdir -p $MEDIA_ROOT_DIR
chmod 777 $MEDIA_ROOT_DIR
else
msg_warning "settings.MEDIA_ROOT missing, passed"
fi
sudo /usr/sbin/service cron start
msg_info "Adding cron task to dump db every day"
cat <(crontab -l) <(echo "") <(echo "* * * * * find $MEDIA_ROOT_DIR/ -type f -name 'Template*.xlsx' -mtime +1 -exec rm {} \; >> /code/persistent_volume/django-crontab.log 2>> /code/persistent_volume/django-crontab.err") | crontab -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment