I wish to possess some database saved configurations for my Django application - some key-value pairs. Does Django possess a conventional method of carrying this out / something built-in for this, or must i implement it myself?

class Setting(models.Model):
     key = models.TextField()
     value = models.TextField()

Obviously, I'd wish to have the ability to store data type for secrets and values. Possibly I possibly could use pickle to coerce all of them into strings.

I have been having fun with the django-satchmo e-store application. Satchmo uses satchmo-livesettings or simply livesettings to do this goal. Additionally to that particular you'll be able to alter the configurations while using admin interface.

The only issue is the fact that I did not look for a tutorial regarding how to use livesettings. But when you see the satchmo code, you'll see results for yourself.

Here's my example

from livesettings import config_register, StringValue, PositiveIntegerValue
SHOP_GROUP = ConfigurationGroup('SHOP', ('ShirtSale Shop Settings'), ordering=0)
CHARGE_PORTO = config_register(
    BooleanValue(SHOP_GROUP,
             'CHARGE_PORTO',
             description = ('Porto Erheben?'),
             help_text = ("Wird bei Bestellungen zusaetzlich ein Porto erhoben?"),
             default = True))

I have incorporated individuals lines within the config.py file. To complete this file it had been essential to:

import config

within the admin.py file (I am wondering whether this really is necessary)

To be able to access the configurations I have incorporated the next towards the web addresses.py file:

(r'^settings/', include('livesettings.urls')),