文章詳情頁
python - flask問題
瀏覽:105日期: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 }}
現(xiàn)在xxx.py
return render_template(’home.html’,posts_list=get_posts_list)
怎么讓recent_post.html里的posts_list獲取到傳過去的值呢
標(biāo)簽問題
問題解答
回答1:<ul>{% for i in posts_list %}<li>{{i}}</li>{% endfor %}</ul>回答2:
標(biāo)簽問題autoescape導(dǎo)致的
上一條:python - 要抓取的網(wǎng)頁內(nèi)容在括號里,正則怎么寫?下一條:flask - python jinja2 如何從獲取javascript function(_index) 傳過來的參數(shù) index?
相關(guān)文章:
排行榜

熱門標(biāo)簽