2015-07-05 84 views
0

我有這樣的錯誤,我不知道原因:Django的 - [錯誤32]破管

此錯誤是在我的控制檯:

[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 '^抑壓demande $', 'supprimer_demande',名字= 「supprimer_demande」),

我查看被JS方法叫:

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

嘗試在URL後添加斜線。 – Othman

+0

我有同樣的錯誤 – YassVegas

回答

3

嘗試刪除
window.location.href = 「/家」;
from your js method go_confirm()。

+0

它的工作原理,但爲什麼? – YassVegas

+0

因爲你正在從你的視圖渲染到另一個位置,而你的函數會告訴它去另一個位置。你介意接受答案嗎? :D –

+0

唉,誰解決它?大聲笑 – YassVegas