Changing Django settings at runtime

前端 未结 7 1293
-上瘾入骨i
-上瘾入骨i 2020-11-30 05:09

I\'d like to expose some (app-specific) settings to the admin interface, so users can change them comfortably and also not have to restart Django.

How should I go ab

7条回答
  •  佛祖请我去吃肉
    2020-11-30 06:10

    DATABASES is a dict. So you can manipulate how a dictionary:

    import django.conf as conf
    
    conf.settings.DATABASES['default']['NAME'] = 'novo_banco'
    

提交回复
热议问题