I recommend using the in-Django 404/500 handler. You can provide meaningful alternative navigation options in a page style that is consistent with the rest of your site.
Make sure that you do not return a page saying an error, but having a return status of 200, a person will understand this error, but there will be no programmatic access. I avoid saying “search engines” here, but the truth is that they are likely to represent 98% + of your inhuman visitors. See subclasses of HttpResponse for more details.
source share