django get settings 1

django get settings

from django.conf import settings 

settings.VARIABLE_NAME

# NOTE - VARIABLE should be in capital letter. 
# It will not work otherwise.

Here is what the above code is Doing:
1. It’s importing the settings.py file from the project’s root directory.
2. It’s accessing the VARIABLE_NAME variable from the settings.py file.
3. It’s assigning the value of the VARIABLE_NAME variable to the VARIABLE variable.

Similar Posts