为什么max_height会产生无效的语法错误?
主文件
max_height = 70
template_values = {
'max_height': max_height # syntax error
...
}
索引.html
<html>
<body>
{% for person in people %}
{% if person.filter("height <", max_height %)
<b>{{ person.first_name }}</b>
<b>{{ person.last_name }}</b>
<b>{{ person.city }}</b>
<b>{{ person.birth_year }}</b>
<b>{{ person.height }}</b>
<hr></hr>
{% endif %}
{% endfor %}
</body>
</html>
编辑 1 这是来自main.py的类 MainPage :
class MainPage(webapp2.RequestHandler):
def get(self):
people_query = Person.all()
people = people_query.fetch(10)
max_height = 70
template_values = {
'people': people
'max_height': max_height
}
template = jinja_environment.get_template('index.html')
self.response.out.write(template.render(template_values))