About Redirecting to Another Page

You can redirect a URL to another page using one of the following:

from django.urls import path
from django.shortcuts import redirect

urlpatterns = [
    path("", lambda request: redirect("dashboard")),
]

or

from django.urls import path, reverse_lazy
from django.views.generic import RedirectView

urlpatterns = [
    path("", RedirectView.as_view(url=reverse_lazy("dashboard"))),
]

Tips and Tricks Programming Django 4.2 Django 3.2 Django 2.2