【发布时间】:2019-06-15 21:47:52
【问题描述】:
这是我的模板:
{% for item in naa %}
<a href="post/{{item['id']}}/{{item['about']}}">{{item['about']}}</a>
{% endfor %}
和烧瓶:
cur.execute("SELECT post_id FROM favorites WHERE username = %s",[session['username']])
data=cur.fetchall()
naa = []
for row in data:
pos_id = row["post_id"]
cur.execute("SELECT* FROM posts WHERE id=%s ORDER BY created_at DESC",[pos_id])
naa.append(cur.fetchall())
cur.close()
return render_template("favoritesm.html",naa = naa)
它正在显示结果,但链接断开,例如:
localhost/post//
那么问题是什么以及如何解决?
谢谢
【问题讨论】: