当我用“GET”方法打电话/购买时,我遇到了这个错误:
jinja2.exceptions.TemplateSyntaxError:意外'%'
{% extends "layout.html" %}
{% block title %}
Buy
{% endblock %}
{% block main %}
<form action="{{ url_for('buy') }}" method="post">
<fieldset>
<div class="form-group">
<input autocomplete="off" autofocus class="form-control"
name="symboll" placeholder="Symbol" type="text"/>
</div>
<div class="form-group">
<input class="form-control" autocomplete="off" autofocus
name="number" placeholder="number of share" type="text"/>
</div>
<div class="form-group">
<button class="btn-default btn" type="submit"> Buy </button>
</div>
</fieldset>
</form>
{% endblock %}
@app.route("/buy", methods=["GET", "POST"])
@login_required
def buy():
if request.method == "GET":
return render_template("buy.html")
答案 0 :(得分:0)
我认为您在login.html
或类似的情况下引发了错误。查找模板中的错误,由login_required
装饰器呈现。