Я не могу понять, как использовать Flask streaming. Здесь мой код:
@app.route('/scans/')
def scans_query():
url_for('static', filename='.*')
def generate():
yield render_template('scans.html')
for i in xrange(50):
sleep(.5)
yield render_template('scans.html', **locals())
return Response(stream_with_context(generate()))
и в моем шаблоне:
<p>{% i %}</p>
Я хотел бы видеть счетчик на странице, который меняется каждые полсекунды. Вместо этого наиболее близким я получил страницу, распечатывающую каждый номер на следующей строке.