You can get the request object in your template by adding the following TEMPLECT_CONTEXT_PROCESSOR binder to your settings:
TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', )
Below is the documentation . Then you can call your template:
{{ request.META.HTTP_NAME }}
And that will give you the base url.
David542
source share