Reputation: 55
I have already searched on the web on this doubt, but they don't really seem to apply to my case.
I have 3 different config files - Dev, Staging, Prod (of course)
I want to modularize settings properly without repetition. So, I have made base_settings.py and I am importing it to dev_settings.py, stg_settings.py etc.
Problem - How to invoke the scripts on each env properly with minimal changes?
Right now, I'm doing this (taking dev env as an example)-
python manage.py runserver --settings=core.dev_settings
This works so far, but I am not convinced on how good workaround is this. Because wsgi.py and a couple of other services have -
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
I am looking to do something without changing the config files of other services. Thank you everyone in advance.
PS - I've tried to be as clear as possible, but please excuse me if anything is unclear.
Upvotes: 1
Views: 1231
Reputation: 23504
Just set DJANGO_SETTINGS_MODULE
in environment variables to your desired config file.
That won't make you to change any of other services config files, and you don't even need to change django settings files.
Upvotes: 2