[Answered ]-What is best way to store and edit global variables in django admin?

2👍

I have an app for this task, check it at https://github.com/barbuza/dbconfig

The only difference from your way is that I suggest to describe configuration sections as forms instead of models

It also have cache support, so your code will not touch database on each read operation on config values

0👍

Its hard to determine the “best way” without all the details, but your solution would work and might meet your needs. A couple draw backs are:

  1. You can only handle percents
  2. Every time you read a setting it is going to require a database call

I always recommend trying to find something before inventing it and there is a new app out there that does something simliar in a more generic fashion. django-setman (not a fan of the name. And there is a more experienced app called live-settings which I have played around with as well.

👤Nix

Leave a comment