Python
[파이썬] Flask - 서버에서 HTML로의 데이터 전달
Sungwoo Koo
2022. 4. 20. 18:39
서버에서 HTML로 데이터 전달
@app.route('/profile/<user_name>')
def show_profile(user_name):
return render_template('profile.html', user_name=user_name)
<user_name> 의 값이 show_profile() 메서드의 매개변수로 들어가서
render_template() 메서드가 실행될 때 user_name=user_name 와 같은 형태로 같이 실어 보낸다