The settings.py file

Settings in Divio Cloud projects will either be configured by addons, or set manually.

Addon-configured settings

Some settings, for example INSTALLED_APPS or MIDDLEWARE (MIDDLEWARE_CLASSES in older versions of Django) are addon-configured settings in Divio Cloud projects, managed by the Aldryn Addons framework.

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 Application configuration with aldryn_config.py file). All these are then loaded into the settings.py by the line:

aldryn_addons.settings.load(locals())

Important

If you declare a setting such as INSTALLED_APPS before 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.

Manually-configured settings

Manually-configured settings, that are not required or handled by any other component, are much easier, and can simply be dropped directly into your settings.py.