首页列表显示全部问答,完成问答详情页布局。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页
        {% block logintitle %}{% endblock %}
        {% block registertitle %}{% endblock %}
    </title>
    <nav style="background-color: white">
        <ul class="nav nav-tabs">
            <li><a href="{{ url_for('lx') }}">首页</a></li>
            {% if username %}
                <li><a href="#">{{ username }}</a></li>
                <li><a href="{{ url_for('logout')}}">注销</a></li>
            {% else %}
                <li><a href="{{ url_for('login') }}">登录</a></li>
                <li><a href="{{ url_for('regist') }}">注册</a></li>
            {% endif %}
            <li><a href="{{ url_for('fabu') }}">发布</a></li>
            <li><input type="text" class="form-control" style=" 200px"></li>
            <button type="button" class="btn btn-default">搜索</button>

        </ul>
    </nav>
    {% block loginhead %}{% endblock %}
    {% block registerhead %}{% endblock %}
</head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="{{ url_for('static',filename='css/webb.css') }}">

<body class="body">

<h1  align="center">欢迎进入我的网站</h1>
{% block body %}
    <div class="container">
    <div class="row clearfix">
        <div class="col-md-2 column">
        </div>
        <div class="col-md-8 column">
            {% for foo in question %}
            <div class="list-group">
                 <a href="" class="list-group-item active">作者:{{ foo.author_id}}</a>

                <div class="list-group-item">
                    <a href="{{ url_for('detail')}}" class="list-group-item-heading">
                        {{ foo.title}}
                    </a>
                    <p class="list-group-item-text">
                        {{foo.detail}}
                    </p>
                </div>
                <div class="list-group-item">
                     <span class="badge">发布时间:{{foo.creat_time}}</span> 发布时间
                </div>
        </div>
             {% endfor %}
        <div class="col-md-2 column">
        </div>
    </div>
</div>
{% endblock %}
<footer class="foot">
    <div><a href="#"> 联系我们</a> · <a href="#"> 加入我们</a> · <a href="#"> 品牌与徽标 </a> · <a href="#">帮助中心</a> · <a href="#">合作伙伴</a>
    </div>
    <div>©2015-2017 广州商学院信息技术与工程学院 / 粤ICP备278953737号-5 / 粤公网安备2015060050046号 / Smrz 粤公网安备201506050046号 / Wxb
        举报电话:020-15533935928
    </div>
</footer>
@app.route('/')
def lx():
    context = {
       'question':Ques.query.all()

    }
    return render_template('lx3.html',**context)

@app.route('/detail/')
def detail():
    # quest=Ques.query.filter(Ques.id == Ques_id).first()
    return render_template('detail.html')

  

原文地址:https://www.cnblogs.com/zheng01/p/7941089.html