制作首页的显示列表。

1、在首页添加显示问答的列表,并定义好相应的样式。

无序列表

<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="#" >{{ user }}</a><br>
         <a  href="#" class="badge" >Title:{{ title }}</a><br>
     <span class="badge" >Time:{{ time }}</span><br>
              <p style="">Detail{{ detail }}</p><br>
    </li>
</ul>

 

2、用字典向index.html传递参数。

@app.route('/')
def index():
    context = {
        'user': 'nini',
        
    }
    return render_template('base.html',**context)

 

posted @ 2017-11-30 18:44  053倪塨槟  阅读(119)  评论(0编辑  收藏  举报