About Using the Single Source of Truth Principle

Don't copy the same configuration variables in multiple places. You can read a variable from Django settings into a Bash variable like this:

1
2
3
4
5
6
DJANGO_SETTINGS_MODULE=myproject.settings.production
DATABASE_NAME=$(   
python manage.py shell -c \
"from django.conf import settings;\
print(settings.DATABASES['default']['NAME'])"
)

Programming Dev Ops Django 4.2 Django 3.2 Django 2.2 Bash Zsh