文章詳情頁
python - flask問題
瀏覽:107日期: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-machine添加一個已有的docker主機問題2. css - 關于div自適應問題,大家看圖吧,說不清3. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””4. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?5. angular.js使用$resource服務把數據存入mongodb的問題。6. dockerfile - [docker build image失敗- npm install]7. docker-compose中volumes的問題8. python - django如何每次調用標簽的時候都取隨機數據9. linux - mysql源碼安裝遇到的問題10. javascript - Vue 自定義控件v-model雙向綁定
排行榜
