您的位置:首页技术文章
文章详情页

python - flask问题

【字号: 日期:2022-09-02 09:08:56浏览:48作者:猪猪

问题描述

问题

home.html

{% extends 'base/base.html' %}{% block title %}Home{% endblock %}{% block content %} {% include './recent_post.html' %}{% endblock %}

recent_post.html

{{ posts_list }}

现在xxx.py

return render_template(’home.html’,posts_list=get_posts_list)

怎么让recent_post.html里的posts_list获取到传过去的值呢

标签问题

问题解答

回答1:

<ul>{% for i in posts_list %}<li>{{i}}</li>{% endfor %}</ul>回答2:

标签问题autoescape导致的

标签: Python 编程
相关文章: