作业29——制作首页的显示列表。

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

<ul class="news-list">
            <li style="padding-left: 0px;padding-right: 10px;box-shadow: #cccccc" class="news">
                <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
                <a href="#">{{ user }}</a><br>
                <a href="#" class="title">{{ title }}</a>
                <span class="badge">{{ time }}</span>
                <p class="detail">{{ detail }}</p>

            </li>
        </ul>

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

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

原文地址:https://www.cnblogs.com/888abc/p/7920908.html