文章詳情頁
python - flask問題
瀏覽:114日期: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. golang - 用IDE看docker源碼時的小問題2. nignx - docker內nginx 80端口被占用3. javascript - vue使用videojs+videojs-contrib-hls報錯4. io - java 文件操作,如何向指定的位置插入內容 (不是替換內容) ?5. javascript - JS 里面的 delete object.key 到底刪除了什么?6. javascript - webpack --hot 熱重載無效的問題7. dockerfile - [docker build image失敗- npm install]8. Python 爬蟲 遇到的問題(手淘問大家)9. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””10. mysql如何配置遠程php外網鏈接數據庫
排行榜
