From 0ec4fc5fe09c0a58059ce47aa26dd4a57b44fdd9 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 13 Sep 2017 13:17:38 +0200 Subject: [PATCH] Enable Sahana debugging using DEBUG env var --- 02-sahana.sh | 11 +++++++---- .../srv/sahana/applications/eden/models/000_config.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/02-sahana.sh b/02-sahana.sh index 4ebf9f4..130d5c4 100755 --- a/02-sahana.sh +++ b/02-sahana.sh @@ -44,10 +44,13 @@ chown -R sahana:sahana /srv/sahana cd /srv/sahana sudo -u sahana python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py -# Set "production values" (increases performance) -sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sahana/applications/eden/models/000_config.py -sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sahana/applications/eden/models/000_config.py -sudo -u sahana python web2py.py -S eden -M -R applications/eden/static/scripts/tools/compile.py +# Set "production values" (increases performance). Only if the DEBUG environment variable doesn't exist +if [ -z "${DEBUG}" ]; then + sed -i 's/settings.base.migrate = True/settings.base.migrate = False/' /srv/sahana/applications/eden/models/000_config.py + sed -i 's/settings.base.debug = True/settings.base.debug = False/' /srv/sahana/applications/eden/models/000_config.py + sed -i 's/#settings.base.prepopulate = 0/settings.base.prepopulate = 0/' /srv/sahana/applications/eden/models/000_config.py + sudo -u sahana python web2py.py -S eden -M -R applications/eden/static/scripts/tools/compile.py +fi # Create uwsgi and nginx app definition cp ${SOURCE_DIR}/sahana/etc/uwsgi/apps-available/sahana.ini /etc/uwsgi/apps-available/sahana.ini diff --git a/sahana/srv/sahana/applications/eden/models/000_config.py b/sahana/srv/sahana/applications/eden/models/000_config.py index 09b55ed..e8cb36d 100644 --- a/sahana/srv/sahana/applications/eden/models/000_config.py +++ b/sahana/srv/sahana/applications/eden/models/000_config.py @@ -63,7 +63,7 @@ settings.base.migrate = True # JS Debug messages are also available in the Console # can also load an individual page in debug mode by appending URL with # ?debug=1 -settings.base.debug = False +settings.base.debug = True # Uncomment this to prevent automated test runs from remote # settings.base.allow_testing = False