【发布时间】:2016-05-16 10:06:56
【问题描述】:
我正在努力设置一个龙卷风网络应用程序,以便每次将新记录插入 MySQL 表时,在刷新 html 页面(甚至更好地不刷新)后,渲染的 html 表中的数据都会更新。
请求处理程序代码如下:
class TestHandler(tornado.web.RequestHandler):
def get(self):
data=sess.query(Country).all()
self.render("test.html", data=data)
html表格代码如下:
<table id="example" >
<thead>
<tr>
<th>name</th>
<th>capital</th>
</tr>
</thead>
<tbody>
{% for dt in data%}
<tr>
<td>{{dt.name}}</td>
<td>{{dt.capital}}</td>
</tr>
{% end %}
</tbody>
</table>
目前,对于 mysql 表端的任何更新,html 表都没有更新。只有重启tornado server时,才会出现新的数据。这个问题可能很初级,但我真的需要一些指导。
【问题讨论】:
标签: html mysql html-table tornado