@app.route('/') def index(): context = { 'questions':Question.query.order_by('-creat_time').all() } return render_template('index首页.html',**context) @app.route('/detail/<question_id>') def detail(question_id): return render_template('detail.html',ques = question_id) {% extends 'base父模板.html' %} {% block title %}问答{% endblock %} <meta charset="UTF-8"> {% block main %} <div class="page-header"> <h3>Title {{ ques }}<br> <small>author r</small> </h3> </div> <p class="lead">detail</p> <hr> <form action="{{ url_for('question') }}" method="post" style="align-content: center"> <div class="form-group"> <textarea name="new_comment" id="new_comment" cols="30" rows="3" class="form-control" placeholder="请输入内容"></textarea> </div> <button type="submit" class="btn btn-default">发送</button> </form> <ul class="list-group" style="margin: 10px"></ul> {% endblock %}