文章详情页
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获取到传过去的值呢
标签问题
问题解答
回答1:<ul>{% for i in posts_list %}<li>{{i}}</li>{% endfor %}</ul>回答2:
标签问题autoescape导致的
上一条:python - 要抓取的网页内容在括号里,正则怎么写?下一条:flask - python jinja2 如何从获取javascript function(_index) 传过来的参数 index?
相关文章:
1. javascript - 关于js原生事件的绑定与解除绑定2. javascript - 手机点击input时,button会被顶上去?求解决!!!3. angular.js - 在ionic下,利用javascript导入百度地图,pc端可以显示,移动端无法显示4. javascript - 网易云信整合到项目的流程5. javascript - 函数声明和匿名函数有什么不同?(前端小白求助。。)6. dologin说是没有定义7. HTML5禁止img预览该怎么解决?8. python - 请问这两个地方是为什么呢?9. mybatis - Java关于Mysql的随机id生成10. mysql - 数据库建字段,默认值空和empty string有什么区别 110
排行榜