制作首页的显示列表。

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

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

{% block main%}
<p>{{user}} context</p>
<ul class="list-group">
    <li class="list-group-item">
        <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
        <a href="#">{{user}}</a>
        <br>
        <a href="#">标题</a>
        <span class="badge">发布时间</span>
        <p style="color:black">内容</p>
    </li>
</ul>
{% endblock %}
@app.route('/')
def index():
    context={
        'user':'kd35',
        'title':'发布”',
        'time':'2017-11-29',
        'detail':'发布内容',
    }
    return render_template('base.html',**context)

 

posted @ 2017-11-30 16:33  004熊锋阳  阅读(78)  评论(0编辑  收藏  举报