The settings.py file¶

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

Addon-configured settings¶

Some settings, for example INSTALLEDAPPS or MIDDLEWARE (MIDDLEWARE_CLASSES in olderversions of Django) are _addon-configured settings in Divio Cloud projects, managed by the AldrynAddons framework.

This allows applications to configure themselves when they are installed; for example, if an addonrequires certain applications to be listed in INSTALLED_APPS, it will add them (this is takencare of in the addon’s Application configuration with aldryn_config.py file). All these are then loaded into thesettings.py by the line:

  1. aldryn_addons.settings.load(locals())

Important

If you declare a setting such as INSTALLED_APPS beforealdryn_addons.settings.load(locals()), it may be overwritten by the addon system.

If you declare it after aldrynaddons.settings.load(locals()), it will overwrite anyconfiguration performed by the addon system. In this case, your setting _will apply, but beaware 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, aremuch easier, and can simply be dropped directly into your settings.py.

原文: http://docs.divio.com/en/latest/reference/configuration-settings-file.html