I have the following structure in my project :
\myapp
application.py
\include
hello.html
so the folder myapp contains application.py and the folder include.
the folder include contains hello.html.
the following code :
application.py
#!/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)
the following code hello.html :
<!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>
THE PROBLEM: Whene I run the program application.py I have this mistake : jinja2.exceptions.TemplateNotFound
TemplateNotFound: hello.html thanks for your help