I've a setting say gi
in settings.py
file. I've created a separate python file (i.e. I'm not using it in views) and used import statement as:
from django.conf import settings
but when I try to access settings.gi
, it says that 'Settings' object has no attribute 'gi'
. What's missing? :s
When you use Django, you have to tell it which settings you're using. Do this by using an environment variable, DJANGO_SETTINGS_MODULE . The value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g. mysite. settings .
Create a settings.py file in your application's package (for example, if your application is named "myapp", put it in the filesystem directory named myapp ; the one with an __init__.py in it.
From the Django docs on creating your own settings states:
Setting names are in all uppercase.
Try renaming the setting to GI
.
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