albatrossandco / brubeck_cms

A Django-based open source CMS for newspapers
Other
5 stars 1 forks source link

Set up settings and local_settings #19

Closed allanjamesvestal closed 13 years ago

allanjamesvestal commented 13 years ago

We need a solution that will import all settings specified in a local_settings.py file and override whatever's in their place within the main settings.py. All settings, overridden and not, need to be accessible through a single import line (we're using 'from django.conf import settings' right now), so that they can be consistently accessed by the 20 files that access them today (and by the god-knows-however-many-more that will exist tomorrow).

myersjustinc commented 13 years ago

Is there any reason we can't simply have from local_settings import * at the end of the main settings.py file?

allanjamesvestal commented 13 years ago

Unfortunately, if we do that none of the local settings will be available via 'from django.conf import settings'. And I think we want things to be accessible that way — both so we don't have to refactor a bunch of things and, more importantly, because that seems to be the standard way to import settings.

myersjustinc commented 13 years ago

Really? That seems to be the way quite a few people are handling it that I've seen, and it should still all be accessible from django.conf.settings. Of course, you'd ideally wrap it in a try/except block:

try:
    from local_settings import *
except ImportError:
    pass

EDIT: Intended to link to this: http://stackoverflow.com/questions/1626326/how-to-manage-local-vs-production-settings-in-django

myersjustinc commented 13 years ago

Resolved in e36fb1f722ed93d260f034dcad15ed956a4b3115.