制作首页的显示列表。
<!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="width: 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"> <div class="list-group"> <a href="#" class="list-group-item active">用户名:{{ user}}</a> <div class="list-group-item"> <h4 class="list-group-item-heading"> {{ title}} </h4> <p class="list-group-item-text"> {{ detail}} </p> </div> <div class="list-group-item"> <span class="badge">发布时间:{{time}}}</span> 发布时间 </div> </div> <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> </body> </html>
@app.route('/')
def lx():
context = {
'user': 'zmz',
'title': '火锅底料',
'time': '2017-11-29',
'detail': '老子吃火锅,你吃火锅底料。',
}
return render_template('lx3.html',**context)