Skip to content

Commit 04ff874

Browse files
CopilotMickLesk
andcommitted
Add DJANGO_SECRET_KEY support for Dispatcharr v0.13.1+
Co-authored-by: MickLesk <[email protected]>
1 parent 11d66bb commit 04ff874

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

ct/dispatcharr.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ function update_script() {
8787
mv /tmp/start-daphne.sh.backup /opt/dispatcharr/start-daphne.sh
8888
fi
8989

90+
# Add DJANGO_SECRET_KEY if missing (required for v0.13.1+)
91+
if [[ -f /opt/dispatcharr/.env ]]; then
92+
if ! grep -q "DJANGO_SECRET_KEY" /opt/dispatcharr/.env; then
93+
msg_info "Adding DJANGO_SECRET_KEY to .env file"
94+
DJANGO_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
95+
echo "DJANGO_SECRET_KEY=$DJANGO_SECRET" >> /opt/dispatcharr/.env
96+
msg_ok "Added DJANGO_SECRET_KEY"
97+
fi
98+
fi
99+
90100
cd /opt/dispatcharr
91101
rm -rf .venv
92102
$STD uv venv

install/dispatcharr-install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ install -d -m 755 \
6262
/data/uploads/{m3us,epgs} \
6363
/data/{m3us,epgs}
6464
chown -R root:root /data
65+
DJANGO_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-50)
6566
export DATABASE_URL="postgresql://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"
6667
export POSTGRES_DB=$DB_NAME
6768
export POSTGRES_USER=$DB_USER
6869
export POSTGRES_PASSWORD=$DB_PASS
6970
export POSTGRES_HOST=localhost
71+
export DJANGO_SECRET_KEY=$DJANGO_SECRET
7072
$STD uv run python manage.py migrate --noinput
7173
$STD uv run python manage.py collectstatic --noinput
7274
cat <<EOF >/opt/dispatcharr/.env
@@ -76,6 +78,7 @@ POSTGRES_USER=$DB_USER
7678
POSTGRES_PASSWORD=$DB_PASS
7779
POSTGRES_HOST=localhost
7880
CELERY_BROKER_URL=redis://localhost:6379/0
81+
DJANGO_SECRET_KEY=$DJANGO_SECRET
7982
EOF
8083
cd /opt/dispatcharr/frontend
8184
$STD npm install --legacy-peer-deps

0 commit comments

Comments
 (0)