私はFlaskを習得し始めていますが、POSTメソッドを可能にするフォームを作成しようとしています。Flask - POSTエラー405メソッドが許可されていません
@app.route('/template', methods=['GET', 'POST'])
def template():
if request.method == 'POST':
return "Hello"
return render_template('index.html')
そして、私のindex.html:
<html>
<head>
<title> Title </title>
</head>
<body>
Enter Python to execute:
<form action="/" method="post">
<input type="text" name="expression" />
<input type="submit" value="Execute" />
</form>
</body>
</html>
正常に動作します(それがGET受信したときにそれをレンダリング)、フォームのロードここに私の方法です。しかし、送信ボタンをクリックすると、POST 405エラーが発生する。なぜそれが表示されていないこんにちは?