I am from PHP background, and I know that constants can be accessed at most of places in a framework and I think it is same in django as well. I tried to have that URL too in django but I tried to have it from django.contrib. I tried to utilize django's Site class and imported that. But the problem is that at time of loading settings.py I can't import any django contrib. file.
So how can I have SITE URL automatically that I can use anywhere, in template as well as at other places.What is the best way to do so? Do any python utility can do so?
Copyright Notice:Content Author:「Hafiz」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12333548/a-way-to-have-django-siteurl-constant-in-settings-py