0👍
✅
Instead of finishing your view with:
return render_to_response(...)
Get the response object and check its status:
out = render_to_response(...)
if out.status_code==404:
# redirect to your 404 page
else:
return out
Source:stackexchange.com