0
私は私のプロジェクトで、以下の構造を有する: \ myappの application.py \ので、フォルダmyappにはapplication.py含まれているとフォルダが含ま
hello.html が含まれます。 フォルダincludeにはhello.htmlが含まれています。 次のコード:jinja2.exceptions.TemplateNotFound
#!/usr/bin/python 2.7.6
# -*- coding:utf-8 -*-
import os
import sys
from flask import Flask,render_template
import psycopg2
app = Flask(__name__)
@app.route('/')
def fihoum():
conn = psycopg2.connect(database="carto", user="postgres",
password="daed5Aemo", host="192.168.12.54")
cur = conn.cursor()
cur.execute("SELECT * FROM carto.\"BADGES_SFR\"")
rows = cur.fetchall()
return render_template('hello.html', titre="Données du client
BADGES_SFR !",mots=rows)
if __name__=="__main__":
app.run(host=os.getenv('IP', '0.0.0.0'),
port=int(os.getenv('PORT',5000)),debug=True)
次のコードhello.html application.py:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>{{ titre }}</title>
</head>
<body>
<h1>{{ titre }}</h1>
<ul>
{% for mot in mots %}
<li>{{ mot }}</li>
{% endfor %}
</ul>
</body>
</html>
問題: Jinja2の:私はこの間違いを持っapplication.py私はプログラムを実行しますWhene。例外.TemplateNotFound
TemplateNotFound:hello.html ご協力ありがとうございます