擅长:python、mysql、java
<p>收到该错误是因为您的<code>show_entries</code>方法需要一个<code>account_id</code>参数,但您的<code>url_for</code>调用没有提供参数。在</p>
<p>看起来您试图让<code>show_entries</code>方法将<code>account_id</code>参数作为表单中的GET值,但作为方法定义中URL(不是GET参数)的一部分,因此存在不匹配。在</p>
<p>您可以为方法定义中的<code>account_id</code>变量指定一个默认值,也可以在GET参数中检查它是否存在:</p>
<pre><code>@app.route('/matcher/', methods=['GET', 'POST'])
@app.route('/matcher/<int:account_id>', methods=['GET', 'POST'])
def show_entries(account_id=0):
if request.method == 'GET' and not account_id:
account_id = request.args.get('account_id', 0)
...
</code></pre>
<p>文档:<a href="http://flask.pocoo.org/docs/0.10/api/#flask.url_for" rel="nofollow">url_for</a>,<a href="http://flask.pocoo.org/docs/0.10/reqcontext/" rel="nofollow">request.args.get</a>。在</p>