Update on database-backed settings

by Marty Alchin on July 16, 2007 about Django

I’ve made a few updates recently to dbsettings, which finally brings the issue count to zero, and adds some new features worth discussing.

The biggest improvement is that it finally uses Django’s cache framework, so it’s able to work properly in multi-process setups. This was essential in order make the framework useful in production environments.

The one caveat is that two of Django’s cache backends aren’t suitable for this framework, and one of those two is actually the default. simple and locmem both store their data internally within a single process, meaning that any updates to your settings won’t be reflected in subsequent requests. All the other backends should work fine, so if you’re moving your app to a multi-process production environment, such as mod_python or FastCGI, make sure you specify a cache backend that’s capable of working properly with dbsettings.

The other significant improvement is the addition of a DecimalValue, allowing non-integer input, and the expansion of PercentValue to support non-integer values. These both use Django’s Decimal module as a fallback if your version of Python doesn’t support Decimal directly, so it should still work in all Python versions Django supports.

I had planned those changes from the beginning, but hadn’t gotten around to them, so Jonathan Buchanan kindly supplied the missing pieces, without even being asked! Things are really starting to shape up.

The last major component left unimplemented at this point is a comprehensive test suite. There’s a lot to test, so the suite will have be considerable. Now that the issue count is down to zero, I’ll have some more time to work on it, but if more issues come in, those will take priority.