Multiple Django Settings files

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:

    <project dir>/
        <configuration dir>/

The file contains almost all of the necessary settings except the DATABASES variable.  The children (,, etc.) import from 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 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 task" just uses the specified in the Settings, and doesn't add any environment variables. Is there any way to have the "run 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, but that seems to be rather big pain to need to do every time I need to use a task.

Please sign in to leave a comment.