制作首页的显示列表。

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

<div id="list-container">
        <ul>
            <li class="list-group-item">
                <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
                帐号:<a href="#" target="_blank">{{ username }}</a>
                <br>
                <a href="#">{{ title }}</a>
                <span class="badge">creat_time</span>
                <p style="...">{{ questions }}</p>
            </li>
        </ul>
    </div>

 

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

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

 

posted @ 2017-12-01 12:05  088郑淑莹  阅读(87)  评论(0)    收藏  举报