Answers for "django exception try catch print error"

1

django try catch exception

from django.http import Http404
#...
def your_view(request)
    #...
    try:
        #... do something
    except:
        raise Http404
        #or
        return redirect('your-custom-error-view-name', error='error messsage')
Posted by: Guest on May-04-2021

Code answers related to "django exception try catch print error"

Python Answers by Framework

Browse Popular Code Answers by Language