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.
This is the code:
Using randint(0,4)
to generate number means that they will sometimes be equal for different users. To generate unique number every time use uuid:
from uuid import uuid4
def random():
session['number'] = str(uuid4())
return None
or generator:
import itertools
consequent_integers = itertools.count()
def random():
session['number'] = consequent_integers.next()
return None