I am trying to create a bash script to create a boilerplate django project that suits for my company. I need to delete the DATABASES in settings and append new one. The DATABASES is a python dictionary with structure
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } }
For this I tried something like this
sed -i -e "/DATABASES = {/,/}/d" settings.py
But it resulted in a trailing }.
The output is
}
I understood that the pattern it matches is for the first curly braces but not the second. What should be the approach for this.
#django #linux #bash