How to configure Django settings¶
This can entail a little extra work when you need to change settings yourself, but the hugeconvenience it offers is more than worth the effort.
The correct way to manage settings such as is to manipulate the existing value,after having loaded the settings from the addons with aldryn_addons.settings.load(locals())
.For example, in the default settings.py
you will find:
You will need to do the same for other configured settings, which will include:
- MIDDLEWARE (or the older MIDDLEWARE_CLASSES)
- application-specific settings, for example that belong to django CMS or Wagtail. See eachapplication’s Application configuration with aldryn_config.py for the settings it will configure.
Sometimes it’s not enough just to add an application or class to a list. It may need to beadded before another item. Say you need to add your application security just before cms. In this case you can target cms in the list like this:
Of course you can use Python to manipulate the collections in any way you require.
Manipulating more complex settings¶
Note that in the case of more complex settings, like MIDDLEWARE
or TEMPLATES
, which are nolonger simple lists, you can’t just extend them directly with new items, you’ll need to dive intothem to target the right list in the right dictionary, for example: