我寫過一個使用DataTables的Django應用程序。問題是,當我從表中刪除一行時,它仍然顯示在表中,當對nginx/gunicorn運行時。但是,當我運行在Django測試服務器上時,它正常工作。所以如果我用這個命令行啓動服務器:Django:行被刪除後仍然顯示 - 因爲緩存?
python manage.py runserver 192.168.0.1:8000
一切工作正常。也就是說,我刪除該行,表刷新,並且不顯示刪除的行。
這是HTTP調用摘要:
// An initial GET command to populate the table
GET /myapp/get_list (returns a list to display)
// I now select a row and delete it which causes this POST to fire
POST /myapp/delete (deletes a row from the list)
// After the POST the code automatically follows up with a GET to refresh the table
GET /myapp/get_list (returns a list to display)
問題是,當我使用nginx的/ gunicorn第二GET調用返回相同的列表作爲第一個GET包括我知道已被刪除的行來自後端數據庫。
我不知道這是一個緩存的問題,或者是因爲這是響應頭,我從第一個GET得到:
Date Fri, 23 Dec 2011 15:04:16 GMT
Last-Modified Fri, 23 Dec 2011 15:04:16 GMT
Server nginx/0.7.65
Vary Cookie
Content-Type application/javascript
Cache-Control max-age=0
Expires Fri, 23 Dec 2011 15:04:16 GMT
如何刪除該行?使用什麼命令? – Daniel
我使用oTable.fnDeleteRow(anSelected);在客戶端。我也通過ajax發送POST請求到服務器(工作)。 – FunLovinCoder