django-base-url

{{ BASE_URL }} django template variable


Keywords
django, base_url, python
License
Unlicense
Install
pip install django-base-url==2020.12.3

Documentation

Installation

$ [sudo] pip install django-base-url

How it works

settings BASE_URL if defined, else scheme+request.get_host()

settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
    "django_base_url.context_processors.base_url",
)

Examples

settings.py:

BASE_URL="http://host/"
<base href="{{ BASE_URL }}">

readme42.com