Flask session is empty after redirect
<p>I have such code:</p>

<pre><code>from flask import Flask, render_template, redirect, request, url_for, session

app = Flask(__name__)


@app.route('/')
def index():
    tmplt = session.get('template', 'No template')
    return render_template('index.html', template=tmplt.decode('utf-8'))


@app.route('/template', methods=['POST'])
def upload_template():
    session['template'] = request.files['template'].read()
    return redirect(url_for('index'))


if __name__ == '__main__':
    app.secret_key = '\x0cw1\xd4\xd5\x80%O?q \xcfQrrk\xa3H\xc0[J\xae&lt;\xc3]\xe6\x10\xc0-\xf8S\x08P4[3]PrK\xa9\xf1'
    app.run(debug=True)
</code></pre>

<p>I expect, that after successful execution of <code>POST /template</code>, variable <code>tmplt</code> will be equal to what was upload. However, it is empty. Debugging shows that <code>session['template']</code> before redirection stores file content, as expected. </p>

<p>Anybody can suggest what's the problem here? Flask docs and googling didn't help :(</p>