title: Flask session variables
body: <p>I'm writing a small web app with flask. I have a problem with session variables when two users (under the same network) try to use app. </p>
  
  <p>This is the code:</p>
  
  <pre><code>import os
  
  from flask import Flask, request, render_template, g, session
  from random import randint
  
  def random():
       session['number'] = randint(0,4)
       return None
  
  @app.route('/')
  def home():
    if not session.get('logged_in'):
      return render_template('login.html')
    else: 
      return check()
  
  @app.route('/login', methods = ['GET', 'POST'])
  def login():
        global username
        username = request.form['username']
        session['logged_in'] = True
        session['username'] = username
        return check()
  
  @app.route('/check', methods=['GET', 'POST'])
  def check():
         random()
         return render_template('file.html', number = session['number'], user = session['username'])
  
  if __name__ == "__main__":
      app.secret_key = ".."
      app.run(host = '0.0.0.0',port = 3134, debug=False)
  </code></pre>
  
  <p>In file.html there is a button type "submit" that call '/check' route. 
  The problem is when two users use app at same time because the variable 'number' is equal to variable 'number' of the last user that push the button... there isn't indipendence between two sessions. </p>
  
  <p>I would that the two users has two indipendence sessions, like if they use my app in local host.   </p>