1.在首页添加显示问答的列表,并定义好相应的样式。
无序列表
<ul >
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
<ul class="list-group"> <li class="list-group-item" > <a class="author" href="">{{ user }}</a> <br> <a class="title" href="">标题</a> <br> <span >发布时间 </span> <p class="abstract">文章内容 </p> </li> </ul>
2. 用字典向index.html传递参数。
@app.route('/') def index(): context={ 'user': 'mis' } return render_template('index.html',**context)