@app.route('/')
def index():
context = {
'questions': Question.query.all()
}
return render_template('index.html',**context)
{% extends 'base.html' %}
{% block title %}首页{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ url_for('static',filename='css/index.css')}}" type="text/css">
{% endblock %}
{% block main %}
<p>{{ username }}欢迎您来到首页!</p>
<div id="list-container">
<ul class="note-list" style="margin:80px auto;width: 1000px;height:800px;background: #FFF;border-radius: 20px;opacity:0.6;filter:alpha(opacity=60);">
{% for foo in questions %}
<li class="note-list-item">
<div class="contain">
<span class="glyphion glyphion-leaf" aria-hidden="true"></span>
<a href="#">{{ foo.author.username }}</a>
<br>
<br>
<a href="#">{{ foo.title }}</a><span class="badge">{{ foo.creat_time }}</span>
<p style="width: 450px;"> 详情 {{ foo.detail }}</p>
</div>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}