[Answered ]-Redirect all page not found to home page

1👍

Just Add this line in urls.py instead of settings.py
Everything else seems ok.

It is also mentioned in the django documentation that setting handler variables from anywhere else will have no effect. It has to be set from URLconf

The default error views in Django should suffice for most web applications, but can easily be overridden if you need any custom behavior. Specify the handlers as seen below in your URLconf (setting them anywhere else will have no effect).

app/urls.py

from . import views

handler404 = 'app.views.redirectPNF' # Added this line in URLconf instead of settings.py


urlpatterns = [ path('home', views.home, name="home"), ]
👤Ayush

Leave a comment