How to configure Django settings for different environments in a modular way?
<p>I have already searched on the web on this doubt, but they don't really seem to apply to my case.</p>

<p>I have 3 different config files - Dev, Staging, Prod (of course)</p>

<p>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. </p>

<p><strong>Problem - How to invoke the scripts on each env properly with minimal changes?</strong></p>

<p>Right now, I'm doing this (taking dev env as an example)- </p>

<p><strong>python manage.py runserver --settings=core.dev_settings</strong></p>

<p>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 -  </p>

<p><strong>os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')</strong></p>

<p>I am looking to do something without changing the config files of other services. Thank you everyone in advance.</p>

<p>PS - I've tried to be as clear as possible, but please excuse me if anything is unclear.</p>

<p>Have a look at the <a href="https://django-configurations.readthedocs.io/en/stable/" rel="nofollow">Django Configurations</a> package.</p>

python django wsgi django-settings