11.30

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

 

<div class="box">
        <ul class="list-group">
            <li class="list-group-item">
                <img style="width: 50px" src="{{ url_for('static',filename='css/touxiang.jpg') }}" alt="64">
                <a href="#">{{ username }}</a><br>
                <a href="#">标题:{{ title }}</a><br>
                <a href="#">详情:{{ detail }}</a>
                <span class="badge" style="margin-left: 60%">{{ create_time }}发布时间</span>
                <p style="margin-left: 25%"></p>
            </li>
            <br>
            <li class="list-group-item">
                <img style="width: 50px" src="{{ url_for('static',filename='css/123.jpg') }}" alt="64">
                <a href="#">{{ username }}</a><br>
                <a href="#">大埔网</a><br>
                <a href="#">大埔是个美丽的地方</a><br>
                <span class="badge" style="margin-left: 60%">{{ create_time }}发布时间</span>
                <p style="align-content: center"></p>
            </li>
        </ul>

    </div>

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

db.create_all()# 首页
@app.route('/')
def index():
    context={
        'title':'大埔',
        'detail':'美丽的地方',
        'username': 'wuyishan',
        'create_time': '2017.11.30',
    }
    return render_template('base.html',**context)

 

posted @ 2017-11-30 16:36  037吴宜珊  阅读(126)  评论(0)    收藏  举报