When you install a new django application, you have to add/modify your settings.py module.
For a project I\'m trying to make that module a python subpackage and crea
Presumably the best way to "merge" varies, attributes by attributes. For example, given several tuples (from the INSTALLED_APPS
of various submodules), you might simply concatenate them into a new tuple (for the INSTALLED_APPS
attribute of the package as a whole), or, if possible duplications are a problem, so something smarter to remove the duplications (in this case you may not care about ordering, so simply tuple(set(tup1+tup2+tup3))
might suffice).
For other cases ("merging" dictionaries, "merging" settings which are just scalars or strings, etc) you'll need different strategies (maybe successive .update
calls for the dictionaries, pick just one according to some criteria for the scalars or strings, etc, etc) -- I just don't see a "one size fits all" approach working here.
"When you install a new django application, you have to add/modify your settings.py module."
I think this is fine as is.
I don't see any reason to change or modify this at all.
What we do, however, is to "subclass" the core settings module.
Our developer-specific and installation-specific files have names like settings_devxy_linux2
and settings_checkout_win32
, etc.
Each of these files starts with from settings import *
to import the core settings and extend those core settings with overrides for a specific installation and platform.
It doesn't require any real work. It does, however, mean that we do most things with django-admin.py
because our settings aren't called settings
.