File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
django_spinproject/modules/srta_data Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 41
41
if [ ! -e $MAIN_FOLDER/.env ]; then
42
42
# Copy template
43
43
cp $MAIN_FOLDER/.env.example $MAIN_FOLDER/.env
44
- SECRET=$(poetry run python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())")
45
- sed -i 's|DJANGO_SECRET_KEY=""|DJANGO_SECRET_KEY="'${SECRET//&/\\ \\ &}'"|g' $MAIN_FOLDER/.env
44
+ SECRET="$(poetry run python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())")"
45
+ # The $ symbol is replaced because django-environ is trying to read the value of an environment variable
46
+ SAFE_SECRET=`printf "%s" "$SECRET" | sed 's/\\ \\ \\ $/~/g' | sed 's/\\ \\ \\ \\ /\\ \\ \\ \\ \\ \\ \\ \\ /g' | sed 's/\\ \\ &/\\ \\ \\ \\ &/g'`
47
+ sed -i 's|DJANGO_SECRET_KEY=""|DJANGO_SECRET_KEY="'$SAFE_SECRET'"|g' $MAIN_FOLDER/.env
46
48
# Show
47
49
cat $MAIN_FOLDER/.env
48
50
echo ".env has been autogenerated, to edit: $ nano $MAIN_FOLDER/.env"
You can’t perform that action at this time.
0 commit comments