Похожие чаты

I need dynamic settings in django, it seems to be

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

5 ответов

19 просмотров

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

Ædel- Автор вопроса
Artem
Django settings.py should be immutable as any othe...

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

Ædel
i'm aware, i already have a model for custom setti...

attention, not django way: do you really need to? just keep application configuration separate from framework

Ædel- Автор вопроса
Artem
attention, not django way: do you really need to? ...

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

Ædel
my goal is to have dynamic session expiry time (an...

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

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта