python - flask问题
本文介绍了python - flask问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
问题
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获取到传过去的值呢
标签问题
解决方案
<ul>
{% for i in posts_list %}
<li>{{i}}</li>
{% endfor %}
</ul>
这篇关于python - flask问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文