Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

settings/__init__.py is going to cause problems #151

@dpoirier

Description

@dpoirier

This code in settings/init.py:

from .base import *
try:
from .local import *
except ImportError, exc:
exc.args = tuple(['%s (did you rename settings/local.py-dist?)' % exc.args[0]])
raise exc

will cause problems anytime you try to specify another settings module. E.g. if you set DJANGO_SETTINGS_MODULE=projectname.settings.staging, then in the course of loading the projectname.settings.staging module, Python will load projectname/settings/init.py, and suddenly unexpected and probably unwanted settings modules are being loaded.

An alternative that seems to work better is to move this code into projectname/settings/default.py and make the default settings module point to that. Then if someone overrides the settings module, the default code never gets loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions