【发布时间】:2012-01-26 23:22:05
【问题描述】:
我编写了一个使用 DataTables 的 Django 应用程序。问题是当我从表中删除一行时,在针对 nginx/gunicorn 运行时它仍然显示在表中。但是,当我针对 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
【问题讨论】:
-
如何删除行?使用什么命令?
-
我使用 oTable.fnDeleteRow(anSelected);在客户端。我还通过 ajax 向服务器发送一个 POST 请求(有效)。
标签: django http nginx datatables gunicorn