Flask Routing

sunj - May 10 - - Dev Community
#hello.py
from flask import request

@app.route('/read/<id>')
def read(id):
    return 'READ'
Enter fullscreen mode Exit fullscreen mode

라우팅으로 받는 파라미터와 같은 이름의 변수를 받는다

#hello.py

@app.route('/create', methods=['GET','POST'])
def creat():
    if request.method == 'POST':
        title = request.form['title']
        body = request.form['body']
        return 'create_post'
    else:
        return 'create_get'
Enter fullscreen mode Exit fullscreen mode

method X
methods = []형식으로 사용

참조 : 유투브 생활코딩

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player