a bit of hassle
i created a model to save the settings (name/value). the instances can be created/updated/deleted using form/view/template
but how can I read those instances into settings.py to actually have the effects of a settings variable?
because i can't seem to import models into settings.py because of circular imports
Django settings.py should be immutable as any other settings because it's impossible to change them correctly in multiprocess environments In case you need to change something not specific for django, the simplest way is to store it in a database and reload in runtime each N minute
i'm aware, i already have a model for custom settings python class CustomSettings(models.Model): name = models.CharField(max_length=255, unique=True) value = models.CharField(max_length=255) that can be created/updated/deleted using form/view/template but idk how to load them into settings.py
attention, not django way: do you really need to? just keep application configuration separate from framework
my goal is to have dynamic session expiry time (and probably more dynamic custom "settings" in the future. i'm using django_session_timeout for this, where session time is set by setting a variable in settings.py named SESSION_EXPIRE_SECONDS i want to be able to change that variable's value using a template/form
settings.py is meant to be static by design as far as I know. I haven't seen any solutions to change it at runtime May be... try to set these settings from environment variables and change with container restart without rebuilding the image
Обсуждают сегодня