From 7f4cb3190aa91ea5c3a0e07d785b6407ed4cda1e Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Thu, 6 Apr 2017 13:26:49 -0700 Subject: [PATCH] Create logs and copy settings_local.py - If the logs file doesn't exist, create it so that django doesn't complain about non-existent log files. - If the settings_local.py exist, copy it too along with settings.py --- web/assets/run.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/web/assets/run.sh b/web/assets/run.sh index ab84719..f7ff319 100755 --- a/web/assets/run.sh +++ b/web/assets/run.sh @@ -10,19 +10,24 @@ done >&2 echo "Postgres is up - continuing" -# Check if the settings file is available and can be imported. - - # Check if we are in the correct directory before running commands. if [[ ! $(pwd) == '/opt/mailman-web' ]]; then echo "Running in the wrong directory...switching to /opt/mailman-web" cd /opt/mailman-web fi +# Check if the logs directory is setup. + +if [[ ! -e /opt/mailman-web-data/logs/mailmanweb.log ]]; then + echo "Create log file..." + mkdir -p /opt/mailman-web-data/logs/ + touch /opt/mailman-web-data/logs/mailmanweb.log +fi + # Check if the settings file exists, exit it not. if [[ ! -e /opt/mailman-web-data/settings.py ]]; then - "Settings file does not exist, please provide one..." + echo "Settings file does not exist, please provide one..." exit 1 fi @@ -30,6 +35,11 @@ fi # it is not on python-path. cp /opt/mailman-web-data/settings.py /opt/mailman-web/settings.py +# Check if the settings_local.py file exists, if yes, copy it too. +if [[ -e /opt/mailman-web-data/settings_local.py ]]; then + cp /opt/mailman-web-data/settings_local.py /opt/mailman-web/settings_local.py +fi + # Collect static for the django installation. python manage.py collectstatic --noinput