Django: How to get the root path of a site in template?
You should be able to access the get_host() method of the request:
<a href="http://{{ request.get_host() }}">Go back home</a>
Though you could probably also do:
<a href="/">Go back home</a>
I found a trick, Use this tag:{{ HTTP_HOST }}
you could do:
<a href="{{ HTTP_HOST }}"> back home <a>
or
<a href="{{ HTTP_HOST }}/what_you_want"> back home <a>
I think the proper way here is use the {% url %}
tag and I'm assuming that you have a root url in your url conf.
urls.py
url(r'^mah_root/$', 'someapp.views.mah_view', name='mah_view'),
Then in your template:
<a href="{% url mah_view %}">Go back home</a>