@app.route('/shouye/')
def shouye():
context = {
'questions':Question.query.order_by('create_time').all()
}
return render_template('hh.html',**context)
{% extends 'base.html' %}
{% block title %}
首页
{% endblock %}
{% block main %}
<link rel="stylesheet" type="text/css" href="../static/css/hh.css">
<p>{{ username }}***</p>
<div class="box">
<ul class="list-group">
{% for foo in questions %}
<li class="list-group-item">
<img style=" 30px" src="{{ url_for('static',filename='css/touxiang.jpg') }}" alt="64">
<a href="#"style="color: red">{{ username }}</a><br>
<a href="#"style="color: red">问题:{{ foo.title }}</a><br>
<p style="align-content: center">{{ foo.detail }}</p>
<span class="badge" style="margin-left: 60%">{{ foo.create_time }}</span>
<p style="margin-left: 25%"></p><br>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}