flaskについて 11/17

          
            @app.route('/input')
          
        
"input"がどこにいくか
          
            @app.route('/input')
            def move_to_input():
                return render_template("input.html")
          
        
"input.html"に移動する

url for

他のところに飛んでいく命令

            
              登録ページ
            
          

テキストボックスの作成

場所

場所<br>
<input type="text" name="place" size="35">

データの送信方法

Webデータの送信方法には"POST"と"GET"の2種類ある。
POST:url2文字をつけない
GET:?+クエリ文字

              
                @app.route('/reg', methods=["POST"])
                def registration():
              
            

ファイルを開く、書き込む

with open('./mmcsv.csv','a', newline='', encoding='utf-8') as file: ()内の"a"の部分が重要である
a:ファイルに付け足す時
r:ファイルを開く時
に使用する

Redirectfor

return redirect(url_for('index'))
()に飛ぶ