Configuring application settings for a Django project
I am currently working on a new project where I need application specific settings that a regular user can edit without modifying a file on the server. For example, there is a "schedule" app, and users need to add and remove timezones for that particular schedule. On top of that, the setting application has to meet the following requirements:
- works with multiple backends (MongoDB, Redis)
- be lightweight
- allow non-admin users to modify the settings from the browser
- does not reinvent the wheel (it leverages forms / widgets concepts Django)
After some searching I took a look at the current apps that might fit the requirements and came up with the following list:
Django-livesettings was born as an application in Satchmo and seems to fit the requirements above in that it auto generates a page where the settings can be modified from a browser. However it has some pretty huge drawbacks:
- the application is heavy and burdened by a singleton approach
- there is no easy way to store settings in different backends
- way more complex than it needs to be
Django-constance seems to be another top contender. It supports multiple backends, it is lightweight and does not seem to suffer from being overengineered. However, it does have some drawbacks:
- the default values need to be added to the settings.py file
- users need Django admin access to modify the settings
Since I cannot have regular users modify the settings.py then django-constance is out.
The last contender, Django-appsettings takes a different approach from the apps above and leverages Django forms and widgets to define the settings in an autoloaded settings.py file. The only drawbacks are:
- it does not support multiple backends
- awkward syntax
- full of magic that might breakdown in the future
I have to say that none of these applications fit the requirements. Django live settings is overengineered, Django constance needs the values added to the settings file and appsettings does not support multiple backends. Furthermore, none of these applications provide an easy way to arrange settings on a page under different groups / headings. There should be a clear separation between the data structure and the structure of the data on the edit page.
The Django community as a whole would benefit from having a simple configuration app that supports multiple backends, leverages the existing forms / widgets in Django, and makes it easy to arrange the settings on a page for editing (using fieldsets etc.). It is surprising that something like this does not exist as of yet since the need is clearly there. So, I want to know how you handle this in your projects:
- what do you use to store these settings assuming you do not put them in the settings.py file?
- how do you display them on a page for editing?
It would be great to get this conversation started, maybe some good can come out of it.