擅长:python、mysql、java
<p>0)变量不要使用大写。常量总是大写。在</p>
<p>1)使用末尾带有“/”的路由,以避免额外的重定向</p>
<pre><code>@app.route('/user_input/', methods = ['POST'])
</code></pre>
<p>2)使用<strong>相同的路线</strong>和<strong>相同的功能</strong>来获得您需要的:</p>
^{pr2}$
<p>3)是的,在将字典传递给<code>jsonify</code>之前,不需要使用<code>json.dumps(pythonDictionary)</code></p>
<p>4)考虑使用<code>request.form.get('key')</code>而不是<code>request.form['key']</code>,因为get()函数<a href="https://www.reddit.com/r/cs50/comments/5saebt/pset_7_flask_requestform_vs_requestformget/" rel="nofollow noreferrer">returns</a>没有key:取而代之的是value引发密钥错误异常。在</p>