📜  django try catch 异常 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:21.997000             🧑  作者: Mango

代码示例1
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')