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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

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

 1 {% block main %}
 2     <img src="{{ url_for('static',filename='images/bd_logo1.png') }}" alt="baidu">
 3     <p>{{ user }} contextx</p>
 4     <ul class="list-group" style="align-content: center">
 5 
 6             <li class="list-group-item">
 7                 <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
 8                 <a href="#">{{ user }}</a>
 9                 <br>
10                 <a href="#">标题</a>
11                 <span class="badge">发布时间</span>
12                 <p style="text-indent: 18px">内容</p>
13             </li>
14 
15     </ul>
16 {% endblock %}
17 
18 
19 @app.route('/')
20 def index():
21     context = {
22         'user':'mis'
23     }
24     return render_template('index首页.html',**context)

 

posted on 2017-11-29 15:49  016李云基  阅读(88)  评论(0编辑  收藏  举报