@app.route('/')
def index():
try:
products = Product.query.all()
return render_template('index.html', products=products)
except Exception as e:
error_text = "<p>The error:<br>" + str(e) + "</p>"
hed = '<h1>Something is broken.</h1>'
return hed + error_text
<!DOCTYPE html>
<html>
<body>
<div class = item>
<ul>
{% for product in products %}
<li>{{product.title}}, {{product.price}}</li>
{% endfor %}
</ul>
</div>
</body>
</html>