1👍
✅
You need getattr()
.
from django.conf import settings
setting_name = "LABEL_NAME"
print(getattr(settings, setting_name))
0👍
from project import settings
print settings.LABEL_NAME
or
from project.settings import *
print LABEL_NAME
- [Answer]-How to retain stacktrace when you must return a value?
- [Answer]-Django model relationships in views and templates
Source:stackexchange.com