HTML
-
[Python] Flask 템플릿 확장하여 여러 html 파일 연결하기Python 2020. 1. 9. 23:53
LINK Cinema 를 만든다면 화면별로 html 파일이 만들어질텐데, 이 파일 간 연결을 Python 의 flask 안에서 어떻게 연결할 것인지 고민이 되었다. 단순 html 의 연결이라면 버튼 등의 html tag 에 특정 html 파일의 경로를 href 로 지정하기만 하면 될텐데 말이다. 이를 위해서는 Flask 웹 프레임워크의 사용 구조를 알아야 한다. templates : 웹 서비스의 html 파일들을 모아두는 폴더이다. 반드시 'templates' 라는 명칭으로 폴더를 생성해야 한다. venv : 가상 환경을 생성하고 관리하는 데에 사용되는 모듈이다. 해당 폴더에 'app.py' 라는 명칭으로 API 를 구현할 파이썬 파일을 생성한다. 나는 templates 폴더 안에 3개의 html 파일을..