qingting

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

{% extends\'index.html\' %}

{% block title %}首页{% endblock %}

{% block head %}{% endblock %}

{% block main %}
    <img src="{{ url_for(\'static\',filename=\'images/pig1.jpg\') }}" alt="qa">
    <p>{{ username }}context</p>
    <ul class="list-group" style="...">
    <li class="list-group-item">
        <span class="glyphicon global-leaf " aria-hidden="true"></span>
        <a href="#">{{ user }}</a><br>
        <a href="#">标题</a>
        <span class="badge">发布时间</span>
        <p style="...">内容</p>
    </li>
    </ul>

{% endblock %}

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

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

  

 

分类:

技术点:

相关文章: