Django “view didn't return an HttpResponse object.”

后端 未结 1 2003
一个人的身影
一个人的身影 2021-01-04 04:22

when i call runDelete, then it will call run, so why \"view didn\'t return an HttpResponse object\" happen?

thanks:)

views.py



        
1条回答
  •  有刺的猬
    2021-01-04 04:30

    Django views are expected to return HttpResponse objects. Your view does call run but it does not return anything (remember that Python functions return None in the absence of a statement explicitly returning something else). So change this line from:

    run(request, build)
    

    to:

    return run(request, build)
    

    Of course this will only work if run returns an HttpResponse instance.

    0 讨论(0)
提交回复
热议问题