From 5bc192cc1f99a1ffe168501c86cea4fa11a9e652 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Fri, 15 Sep 2017 20:59:21 +0200 Subject: [PATCH] correct checksum and use virtualenv in upgrade --- scripts/install | 2 +- scripts/upgrade | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index b93f9c6..60e1678 100755 --- a/scripts/install +++ b/scripts/install @@ -191,7 +191,7 @@ ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/CONFIG_FILE" +ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index bfe88d2..944ef92 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,12 +76,18 @@ ynh_system_user_create $app # Migrate databases #================================================= -cd "$final_path" && python3 ./manage.py migrate +( + set +eu + source ${final_path}/venv/bin/activate + export DJANGO_SETTINGS_MODULE="weblate.settings" + cd ${final_path} + weblate migrate --noinput +) # Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" +ynh_backup_if_checksum_is_different "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" # Recalculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/CONFIG_FILE" +ynh_store_file_checksum "$final_path/venv/lib/python2.7/site-packages/weblate/settings.py" #================================================= # SETUP LOGROTATE