diff --git a/ct/dispatcharr.sh b/ct/dispatcharr.sh index cf9bea3b3e..0cbc3b567c 100644 --- a/ct/dispatcharr.sh +++ b/ct/dispatcharr.sh @@ -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 diff --git a/install/dispatcharr-install.sh b/install/dispatcharr-install.sh index a968c86342..d5da5741f8 100644 --- a/install/dispatcharr-install.sh +++ b/install/dispatcharr-install.sh @@ -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 </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