Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #catch #exception
ADD COMMENT
Topic
Name
1+6 =