1 Commits

Author SHA1 Message Date
e10fc6d116 staging deploy: load .env.staging before manage.py
All checks were successful
CI / test-and-quality (push) Successful in 1m25s
2026-02-28 13:01:35 +00:00

View File

@@ -25,6 +25,23 @@ cd /opt/wpp-staging/app
runuser -u wpp -- python3 -m venv .venv
runuser -u wpp -- .venv/bin/pip install -U pip >/dev/null
runuser -u wpp -- .venv/bin/pip install -r requirements.txt >/dev/null
STAGING_ENV_FILE=\"\"
for candidate in \
/opt/wpp-staging/app/infra/staging/.env.staging \
/opt/wpp-staging/app/infra/env/.env.staging \
/opt/wpp-staging/.env.staging; do
if [ -f \"\$candidate\" ]; then
STAGING_ENV_FILE=\"\$candidate\"
break
fi
done
if [ -z \"\$STAGING_ENV_FILE\" ]; then
echo \"[deploy] ERROR: staging env file not found (.env.staging)\" >&2
exit 1
fi
set -a
. \"\$STAGING_ENV_FILE\"
set +a
runuser -u wpp -- .venv/bin/python manage.py shell -c \"from django.conf import settings; import sys; engine = settings.DATABASES['default']['ENGINE']; print(f'DB_ENGINE={engine}'); sys.exit(0 if engine != 'django.db.backends.sqlite3' else 1)\"
runuser -u wpp -- .venv/bin/python manage.py migrate --noinput
systemctl restart wpp-staging.service