You need to add a parameter exception as below in view def handler40(request, exception): #correctly spell 'exception' return HttpResponse("sandy not found")