制作首页的显示列表。
在首页添加显示问答的列表,并定义好相应的样式。
无序列表
<ul >
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ul class="list-group"> <li class="list-group-item" style="width: 800px"> <span class="glyphicon glyphicon-left" aria-hidden="true"></span> <a href="#" target="_blank">{{ user }}</a> <br> <a href="#">{{ title }}</a> <span class="badge">发布时间:{{ time }}</span> <p style="">{{ detail }} </p> </li> </ul>
2. 用字典向index.html传递参数。
@app.route('/') def moban(): context={ 'user':'ghhh123', 'title':'发布', 'time':'2017-11-29', 'detail':'发布内容', } return render_template('moban.html',**context)