FLASKの画面遷移がおかしい
解決したいこと
aws環境でのFLASKの画面遷移について
クラウド9でFLASKの画面遷移を試してみようと思い書いてみたのですが、設定した遷移先のURL:~/resultに移動すると以下のようなメッセージが表示されました。
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
参照したサイトのように遷移先のURLについても何か設定が必要なのでしょうか。
もしよろしければ回答よろしくお願いします。
参照したサイト
ファイル構成
myapp
│└─app.py
│
└─templates
└─app.html
app.py
from flask import Flask, request, render_template
import os
import calendar
app = Flask(__name__)
@app.route('/')
def hello():
return render_template("app.html")
if __name__ == "__main__":
app.run(host = '0.0.0.0', port = 50000)
app.debug = True
@app.route("/result", methods=["POST"])
def result():
return render_template("app.html")
app.html
<html lang="ja">
<head>
<meta charset=utf-8>
<body>
<h3>適当なフォーム</h3>
<form action="/result" method="post">
<p> <input type="text" name="a"> </p>
<p> <input type="text" name="b"> </p>
<p> <input type="text" name="c"> </p>
<p> <textarea rows=5 cols=50 name="d"></textarea> </p>
<p> <input type="submit" value="テスト"> </p>
</form>
<p>{{b}}</p>
</body>
</html>
0 likes