django import settings variables 1

django import settings variables

from django.conf import settings 
settings.VARIABLE # to access variable

Here is what the above code is Doing:
1. It’s importing the settings module from the django.conf package.
2. It’s accessing the VARIABLE attribute of the settings module.
3. It’s assigning the value of the VARIABLE attribute to a variable called VARIABLE.

Similar Posts