Can you not use the Django `url` template tag to get the base URL? Same comment for below.