Sometimes, we want to change Python Django settings at runtime.
In this article, we’ll look at how to change Python Django settings at runtime.
How to change Python Django settings at runtime?
To change Python Django settings at runtime, we can set the conf.settings
dictionary.
For instance, we write
import django.conf as conf
conf.settings.DATABASES['default']['NAME'] = 'abc'
to set the conf.settings.DATABASES['default']['NAME']
field to a value in the entry point of our app.
Conclusion
To change Python Django settings at runtime, we can set the conf.settings
dictionary.