Q:

How to get getting base_url in django template

Given a website, how would you get the HOST of that in a django
template?
I have tried:
{{ request.get_host }}

But it returns the IP address.

A:

You can use the request.META dictionary to get the hostname.
{{ request.META.get('HTTP_HOST', '') }}

A: