How to get getting base_url in django template
django, python
Solution
This has been answered extensively in the following post
There are several ways of doing it:
- As david542 described **
- Using `{{ request.get_host }}` in your template **
- Using the `contrib.sites` framework
** Please note these can be spoofed
Problem
Given a website, how would you get the HOST of that in a django template, without passing that var from the view? ``` http://google.com/hello --> {{ BASE_URL }} ==> 'http://google.com' ```