fix(wger): declare the database in the environment for wger 2.7

wger 2.7 removed the implicit sqlite fallback from settings/main.py, so
DJANGO_DB_ENGINE / DJANGO_DB_DATABASE are now mandatory and the add-on
aborted at startup with ImproperlyConfigured. Set them explicitly,
keeping the persistent /data/database.sqlite path.

Closes #3043

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
claude[bot]
2026-09-05 03:18:59 +00:00
parent 01a865cffc
commit c30629aa8b
4 changed files with 21 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
## 2.6.4 (2026-09-05)
- Fix the add-on failing to start with `ImproperlyConfigured: Set the DJANGO_DB_ENGINE environment variable`: wger 2.7 removed the implicit sqlite fallback from its settings, so the database is now declared explicitly through `DJANGO_DB_ENGINE` / `DJANGO_DB_DATABASE`, still pointing at the persistent `/data/database.sqlite`
- Replace the misleading "Unable to find Python settings containing database path" warning with an informational message, as wger no longer hardcodes that path
## 2.6.3 (2026-08-01)
- Version renamed from `2.6-dev-3`, which Home Assistant could not order and therefore could not reliably offer as an update: every number of the previous version is kept, as a section of its own. The addon itself and the upstream version it tracks are unchanged

View File

@@ -34,6 +34,18 @@ ENV SYNC_EXERCISES_ON_STARTUP=True \
DJANGO_MEDIA_ROOT="/data/media" \
DJANGO_STATIC_ROOT="/data/static"
# wger 2.7 dropped the implicit sqlite fallback in settings/main.py, so the
# database has to be declared through the environment or Django aborts with
# "Set the DJANGO_DB_ENGINE environment variable".
# USER/PASSWORD/HOST/PORT are ignored by the sqlite backend; they are set
# because wger 2.6 read them without a default, so both base images boot.
ENV DJANGO_DB_ENGINE="django.db.backends.sqlite3" \
DJANGO_DB_DATABASE="/data/database.sqlite" \
DJANGO_DB_USER="" \
DJANGO_DB_PASSWORD="" \
DJANGO_DB_HOST="" \
DJANGO_DB_PORT="5432"
USER root
RUN echo "wger ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \

View File

@@ -23,5 +23,5 @@ schema:
slug: wger
udev: true
url: https://github.com/alexbelgium/hassio-addons
version: "2.6.3"
version: "2.6.4"
webui: "[PROTO:ssl]://[HOST]:[PORT:80]"

View File

@@ -62,7 +62,9 @@ if [ "${#SETTINGS_FILES[@]}" -gt 0 ]; then
sed -i "s|/home/wger/db/database.sqlite|/data/database.sqlite|g" "$settings_file"
done
else
bashio::log.warning "Unable to find Python settings containing database path under /home, skipping rewrite"
# Expected on wger >= 2.7: the settings no longer hardcode a database path,
# it is taken from DJANGO_DB_DATABASE instead (set in the Dockerfile)
bashio::log.info "Settings do not hardcode a database path, using DJANGO_DB_DATABASE=${DJANGO_DB_DATABASE:-/data/database.sqlite}"
fi
#####################