Using Django, you can override the default 404 page by doing this in the root urls.py
:
handler404 = 'path.to.views.custom404'
How to do this when using Class based views? I can't figure it out and the documentation doesn't seem to say anything.
I've tried:
handler404 = 'path.to.view.Custom404.as_view'
Never mind, I forgot to try this:
from path.to.view import Custom404
handler404 = Custom404.as_view()
Seems so simple now, it probably doesn't merit a question on StackOverflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With