As I can see, you have a small mistake, but do not worry.
Look, try the following:
handler404 = 'mysite.views.error404'
Then in mysite (second mysite) view.py is created if you don't have one. In this view.py put:
from django.shortcuts import render def error404(request): return render(request,'404.html')
and all! In the templates, create this file and do something nice!
Remember that it only works in production (DEBUG=False) otherwise django uses tracing. The same goes for 505, and you can probably try handler404 = 'polls.views.see404' and put it in views.py, but, you know, it tastes different hehe.
Now try something else like: comment in urls.py
#handler404 = 'mysite.views.error404'
and delete also in views.py def.
A simple 404.html is created in the index of your template file. Start the server in production and produce a 404 error, what happened?
source share