flask: Python 으로 웹응용프로그램을 개발하기 위한 웹 프레임워크
jinja: Python 웹 프레임워크인 Flask에 내장되어 있는 Template 엔진(https://jinja.palletsprojects.com/en/2.10.x/)
- test_Jinja.py
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html', title ='Flask Template Test', home_str = 'Hello Flask!', home_list = [1, 2, 3, 4, 5])
app.run(debug=True)
- index.html
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
{% if title %}
<title>{{title}} </title>
{% endif %}
</head>
<body>
<h1>Bind String : {{home_str}}</h1>
<ul>
{% for idx in home_list %}
<li>{{idx}}</li>
{% endfor %}
</ul>
</body>
</html>
'[WEB 개발] > FLASK_JINJA' 카테고리의 다른 글
영상을 yolov3로 검출하고 flask를 이용해 웹에 출력 (1) | 2020.02.07 |
---|---|
flask + jinja를 이용한 화면에 영상출력 (0) | 2020.02.06 |