
📁templates 폴더 생성 후 html 파일(템플릿)을 폴더 안으로 이동from flask import render_template 임포트render_template 메소드를 호출 후 html 파일 이름을 전달🏗️ personal-site-form.html
Day41-42의 HTML 파일 활용
⌨️ server.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def home():
return render_template("personal-site-form.html")
if __name__ == "__main__":
app.run(debug=True)
정적 파일인 프로필 사진이 렌더링되지 않음
📁static 폴더 생성 후 정적 파일(이미지, 비디오, CSS 파일 등)을 폴더 안으로 이동static/파일 이름이 된다❗️크롬 브라우저에서 변경된 내용이 바로 적용되지 않을 경우 강력 새로고침(shift + 새로고침) 하기
(정적 파일, 자바스크립트 등 자주 바뀌지 않는 것들을 캐시로 저장하여 인터넷 사용을 절약하기 때문)
🏗️ personal-site-form.html
…
<td><img src="static/profile.png" alt="profile pic" width="150" height="150"></td>
…
이미지가 정상적으로 렌더링된 모습
개발자 도구 → 콘솔 → document.body.contentEditable=true 입력(JS 코드)delete 키
파일 → 페이지를 다른 이름으로 저장 으로 웹페이지 저장🔍 유의 사항
- 무료 템플릿 웹사이트에서 가져온 템플릿을 바꿔서 간단한 명함 형태 제작하기
- 강의에서 사용한 명함 모양 템플릿은 더 이상 제공되지 않아서 임의로 변경