Answers for "django settings"

7

django import settings

from django.conf import settings
Posted by: Guest on September-15-2020
2

access the value in settings django

#settings.py

EMAIL_PASS = "FOO"

# in any file 
from django.conf import settings 
email_password = settings.EMAIL_PASS #to access that variable.
Posted by: Guest on January-03-2021
0

django get settings

from django.conf import settings 

settings.VARIABLE_NAME

# NOTE - VARIABLE should be in capital letter. 
# It will not work otherwise.
Posted by: Guest on September-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language