TIL# 14 22.12.01.목

Han Lee·2022년 12월 1일
0

TIL

목록 보기
6/43

Flask에 대해 개인적으로 조금 더 알아보려고 했다.

from flask import Flask, render_template
import sys
application = Flask(__name__)


@application.route("/")
def hello():
    return render_template('hello.html')

if __name__ == "__main__":
    application.run(host='0.0.0.0')

render_template -> flask는 html을 불러오려면 render_template이 필요하고 html이 templates폴더에 있어야 한다.

if __name__ == "__main__":

파일을 직접 실행 했을 때는 ture값으로 실행은 되지만 다른 파일에 불러서 사용할 떄는 수행이 안되게 만드는 코드

https://velog.io/@new_wisdom/Python-Mysql-연동하기-insert

postman post할때 body에 꼭 값을 입력하자

profile
렌덤형 인간

0개의 댓글