Hello, first off, my apologies if this question has already been answered:
I starting to work on a new Django project for which there are multiple settings files.
My project structure looks like:
The base.py file contains almost all of the necessary settings except the DATABASES variable. The children (dev.py, prod.py, etc.) import from base.py then continue to set additional variables, like the database it's connecting to, whether any additional apps are installed, whether DEBUG is enabled, etc.
I've manage to create multiple run configurations for each of the settings files I have, in which I've modified the environment variable DJANGO_SETTINGS_MODULE to point to the desired file. This all works great.
However, if I try and do any manage.py tasks using the menu option, i run into the following error:
django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not
configured. You must either define the environment variable DJANGO_SETTINGS_MODULE
or call settings.configure() before accessing settings.
I'm assuming that the "run manage.py task" just uses the manage.py specified in the Settings, and doesn't add any environment variables. Is there any way to have the "run manage.py task" use the environment variables that are setup for that specific run configuration? Or is there any other alternative beyond editing either theSettings -> Django Support -> Settings / Manage script options (as I don't want to change it every time I change a run configuration)?
Thanks in advance.
EDIT: I realize I can use Shift + Enter, and use the options --settings=path.to.settings, but that seems to be rather big pain to need to do every time I need to use a manage.py task.