Django - [Errno 32]破管

时间:2015-07-05 13:55:04

标签: python django

我有这个错误,我不知道原因:

此错误发生在我的控制台中:

[05/Jul/2015 15:42:35] "POST /suppression-demande HTTP/1.1" 200 4262
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
self.send_preamble()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/usr/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[05/Jul/2015 15:42:35] "POST /suppression-demande HTTP/1.1" 500 59

单击按钮,将调用此JS方法:

function goto_confirm(username){
    adress = "/suppression-demande"
    if(confirm("Are you sure ?")){
        $.ajax({
             type:"POST",
             url:adress,
             data: {
                    'confirmation_suppression': true,
             },
             success: function(data){
                 alert("data : "+data);
             }
        });

        window.location.href = "/home";
    }

    return false;
}

网址:     url(r' ^ suppress-demande $',' supprimer_demande',name =" supprimer_demande"),

我的视图由js方法调用:

def supprimer_demande(request):   
    confirmation = request.POST.get("confirmation_suppression")
    return render(request,"website/lsdme.html")

1 个答案:

答案 0 :(得分:3)

尝试删除
window.location.href =" / home&#34 ;;
来自你的js方法go_confirm()。