In my views.py
I have
from django.conf import settings
def site_view(request):
...
if some_var == settings.MY_SETTING:
...
The value MY_SETTING
is defined in settings.py
. However I get the following error when I try and load the view:
Exception Type: AttributeError
Exception Value: 'function' object has no attribute 'MY_SETTING'
What's going on?
How about importing settings like:
from django.conf import settings as conf_settings
then:
if some_var == conf_settings.MY_SETTING:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With