Divio Cloud Django projects that use our addons framework are shipped with a
settings.py file that hooks into the
framework. The framework allows addon applications to configure their own settings programmatically.
At first sight, this
settings.py file may seem unusual, but in fact it behaves as a standard Django settings module.
INSTALLED_ADDONS lists the addons installed by the addons framework. The list is populated automatically:
- on the Control Panel, when addons are added or removed
- locally, when the
divio project developcommand is run
Items are inserted between the
<INSTALLED_ADDONS> tags. If you need to add items to the list manually while
developing, add them outside the tags, otherwise your changes will be overwritten the next time
develop is run.
INSTALLED_ADDONS = [ # <INSTALLED_ADDONS> ... # </INSTALLED_ADDONS> ]
Settings in Divio Cloud projects can either be configured automatically via the addons framework, or set manually.
Settings that are configured by addons¶
Some settings, for example
MIDDLEWARE_CLASSES in older
versions of Django) are addon-configured settings in Divio Cloud projects, managed by the Aldryn
This allows applications to configure themselves when they are installed; for example, if an addon
requires certain applications to be listed in
INSTALLED_APPS, it will add them (this is taken
care of in the addon’s Addon configuration with aldryn_config.py file). All these are then loaded into the
settings.py by the line:
If you declare a setting such as
aldryn_addons.settings.load(locals()), it may be overwritten by the addon system.
If you declare it after
aldryn_addons.settings.load(locals()), it will overwrite any
configuration performed by the addon system. In this case, your setting will apply, but be
aware that logic in the addon’s
aldryn_config.py might operate based on a different value,
with unpredictable results.
See How to configure Django settings for examples of how to handle these settings correctly.
Settings that are configured manually¶
Manually-configured settings, that are not required or handled by any other component, can simply be dropped directly into your