文章詳情頁
python - flask問題
瀏覽:174日期: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獲取到傳過去的值呢
標簽問題
問題解答
回答1:<ul>{% for i in posts_list %}<li>{{i}}</li>{% endfor %}</ul>回答2:
標簽問題autoescape導(dǎo)致的
上一條:python - 要抓取的網(wǎng)頁內(nèi)容在括號里,正則怎么寫?下一條:flask - python jinja2 如何從獲取javascript function(_index) 傳過來的參數(shù) index?
相關(guān)文章:
1. javascript - sublime快鍵鍵問題2. javascript - 移動端上不能實現(xiàn)拖拽布局嗎?3. 實現(xiàn)bing搜索工具urlAPI提交4. javascript - 如何判斷不同兩個對象觸發(fā)同一事件?5. ubuntu - apache安裝好后php文件放在哪里?6. javascript - react native在run-android時出現(xiàn)這個錯誤該怎么解決?大神賜教7. angular.js - 單頁應(yīng)用(ng/vue)該如何監(jiān)聽用戶離開當前頁面(或者路由)?8. c++ - QWebEngineView加載url后直接點擊鏈接沒有反應(yīng)要怎么解決?9. 前端 - 這段代碼一直生效不了,查半天因為 top: 0px; 分號后一個隱藏的東西,也不是占位符...刪了就可以生效,這是什么情況。。10. thinkPHP5中獲取數(shù)據(jù)庫數(shù)據(jù)后默認選中下拉框的值,傳遞到后臺消失不見。有圖有代碼,希望有人幫忙
排行榜

熱門標簽
網(wǎng)公網(wǎng)安備