About Multiple URL Configurations

The reverse() function accepts urlconf parameter where you can pass URL configuration of a website. This is useful when your project serves multiple sites under different subdomains, with separate URL configurations.

1
2
3
4
5
from django.urls import reverse

terms_of_use_url = "https://www.example.com{}".format(
    reverse("terms_of_use", urlconf="myproject.urls.www"),
)

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2