Add the new siteconfig app for Djblets for dynamic site-wide configuration
Review Request #479 — Created July 30, 2008 and submitted
Django's settings file is nice for customizing site settings, so long as the values don't need to be changed often. It's less useful when you want to give users the ability to quickly change things or experiment with the site configuration, since it requires logging into the server, hand-editting a file, and restarting. The new djblets.siteconfig app provides a means to fix this. Settings data is stored in a SiteConfiguration model linked to the active Site. The setting values can be of any type supported by Django's simplejson, meaning dictionary values, arrays, and other such things work fine. To ease customization of settings, a special Form object is provided that settings pages can subclass. Each field in the Form can be a stored setting and Djblets will handle the loading/saving automatically. These Forms support fieldsets for grouping objects, descriptions of fieldsets, and disabled fields (with reasons why they're disabled). Mapping tables and utility functions exist to transition to and from many of the built-in Django settings. Not all settings are provided, but the ones sites would most likely want to customize are. Sites are meant to add these mapping tables as defaults, which will ensure that accessing the siteconfig version of the setting would return the value saved in the settings.py file, and forms that change these settings can call a function in their save handler to write the values back to the in-memory Settings object, meaning that the database will always take precedence but that apps accessing the Settings object instead of the SiteConfiguration will receive the correct value.
Tested with my upcoming change for Review Board. Settings of various types are loaded and saved as expected. The Django Settings compatibility appears to work perfectly fine.