django try catch exception

Solutions on MaxInterview for django try catch exception by the best coders in the world

showing results for - "django try catch exception"
Sofia
30 Oct 2018
1from django.http import Http404
2#...
3def your_view(request)
4    #...
5    try:
6        #... do something
7    except:
8        raise Http404
9        #or
10        return redirect('your-custom-error-view-name', error='error messsage')
11