[Django]-How to store singular dynamic values in a Django web application?

1👍

I think for this case it better to use existing solutions like Constance – Dynamic Django settings. It is general solution for modifiable variables through django admin interface.

Here is list of similar apps https://djangopackages.org/grids/g/live-setting/

2👍

You could use python’s shelve for a simple out-of-the-box solution for object persistence. It’s easy to use:

with shelve.open('my_store') as my_store:
    my_store['ranking'] = 10

and then:

with shelve.open('my_store') as my_store:
    ranking = my_store['ranking']

Hope this helps!

Leave a comment