Add DJANGO_SECRET_KEY support for Dispatcharr v0.13.1+ (#9730)

* Initial plan

* Add DJANGO_SECRET_KEY support for Dispatcharr v0.13.1+

Co-authored-by: MickLesk <47820557+MickLesk@users.noreply.github.com>

* Improve DJANGO_SECRET_KEY generation to ensure consistent 50 character length

Co-authored-by: MickLesk <47820557+MickLesk@users.noreply.github.com>

* short

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MickLesk <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
Copilot 2025-12-07 12:38:37 +01:00 committed by GitHub
parent 64dbd4e9f7
commit 1ecb5bbeab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,11 @@ function update_script() {
mv /tmp/start-daphne.sh.backup /opt/dispatcharr/start-daphne.sh
fi
if ! grep -q "DJANGO_SECRET_KEY" /opt/dispatcharr/.env; then
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
echo "DJANGO_SECRET_KEY=$DJANGO_SECRET" >> /opt/dispatcharr/.env
fi
cd /opt/dispatcharr
rm -rf .venv
$STD uv venv

View File

@ -62,11 +62,13 @@ install -d -m 755 \
/data/uploads/{m3us,epgs} \
/data/{m3us,epgs}
chown -R root:root /data
DJANGO_SECRET=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
export POSTGRES_DB=$DB_NAME
export POSTGRES_USER=$DB_USER
export POSTGRES_PASSWORD=$DB_PASS
export POSTGRES_HOST=localhost
export DJANGO_SECRET_KEY=$DJANGO_SECRET
$STD uv run python manage.py migrate --noinput
$STD uv run python manage.py collectstatic --noinput
cat <<EOF >/opt/dispatcharr/.env
@ -76,6 +78,7 @@ POSTGRES_USER=$DB_USER
POSTGRES_PASSWORD=$DB_PASS
POSTGRES_HOST=localhost
CELERY_BROKER_URL=redis://localhost:6379/0
DJANGO_SECRET_KEY=$DJANGO_SECRET
EOF
cd /opt/dispatcharr/frontend
$STD npm install --legacy-peer-deps