制作首页的显示列表

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

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

{% block main%}
<img src="{{url_for('static',filename='images/logo.png')}}" alt="qa">
<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 %}
db.create_all()
# 首页
@app.route('/')
def index():
    context={
        'title':'title',
        'detail':'detail',
        'username': 'xie',
        'create_time': 'create_time',
    }
    return render_template('base.html',**context)
复制代码
 

 

 

 

posted @ 2017-12-01 21:52  066谢平坚  阅读(103)  评论(0)    收藏  举报