내배캠_웹개발종합반_8일차

hare·2022년 10월 26일
0

Flask 프레임워크

  • 서버를 쉽게 만들 수 있도록 도와주는 큰 라이브러리

📁디렉토리 생성
templates - html파일
static - 이미지, css파일 등

html파일 불러오기

render_template

from flask import Flask, render_template
app = Flask(__name__)

@app.route('/')
def home():
   return render_template('index.html')
   
if __name__ == '__main__':
   app.run('0.0.0.0',port=5000,debug=True)

html파일을 여는 것과의 차이점

"배포"
서버에서 작동하기때문에 타인도 볼 수 있는 웹페이지

↔내 컴퓨터의 파일을 여는 것!


mypage서버 생성

@app.route('/mypage')
def mypage():
   return 'This is Mypage!'
profile
해뜰날

0개의 댓글