文章详情页
python - flask问题
浏览:203日期: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. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?2. docker api 开发的端口怎么获取?3. docker镜像push报错4. PHP中的$this代表当前的类还是方法?5. macos - mac下docker如何设置代理6. 如何解决Centos下Docker服务启动无响应,且输入docker命令无响应?7. 老师,flex-shrink: 1; 按视频操作,不会自动缩放8. 前端 - 类到底该如何去命名 .newsList 这种的命名难道真的不是过度语义化吗?~9. sublime-text - sublime text 3中编译python(sublimeREPL),如何仅运行单行/选定部分10. android glide asbitmap 在baseadpter中的问题
排行榜

网公网安备