文章详情页
python - flask问题
浏览:94日期:2022-09-02 09:08:56
问题描述
问题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 - 要抓取的网页内容在括号里,正则怎么写?下一条:flask - python jinja2 如何从获取javascript function(_index) 传过来的参数 index?
相关文章:
1. python小白的基础问题 关于while循环的嵌套2. php自学从哪里开始?3. MySQL客户端吃掉了SQL注解?4. 数据库 - MySQL 单表500W+数据,查询超时,如何优化呢?5. mac 安装 python_MySQLdb6. 求大神帮我看看是哪里写错了 感谢细心解答7. javascript - 百度echarts series数据更新问题8. javascript - 图片能在网站显示,但控制台仍旧报错403 (Forbidden)9. mysql - AttributeError: ’module’ object has no attribute ’MatchType’10. phpstady在win10上运行
排行榜
