制作首页的显示列表
1. 在首页添加显示问答的列表,并定义好相应的样式。
无序列表
<ul >
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
2. 用字典向index.html传递参数。
<ul class="list-group"style="width: 400px"align="left"> <li class="list-group-item"style="background-color:lightpink;height:205px;width:400px;float:right;"> <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span> <a href="http://www.jianshu.com/">user:</a> <br> <a href="http://www.jianshu.com/">title:</a> <br> <span class="badge">creat_time:</span> <p style="color:black">{{ questions }}</p> </li> </ul>
@app.route('/') def base2(): context = { 'question': '巴拉拉能量' } return render_template("base2.html", **context)