I'm a newbie on Python and I'm trying to convert an ASP.NET application to Python to allow myself to understand Python.
I've chosen FLASK
as the framework for the Python application.
Now, in .NET I've relied on sessions to identify a customer, however, this doesn't seem to work in Python - Flask.
This is my code:
@APP.errorhandler(404)
def notFound(error):
if (session.get("demo") == None):
session["demo"] = "value"
return "This is a new session."
else:
return "This is an existing session."
if __name__ == "__main__":
APP.secret_key = APP.config["FLASK_SECRET_KEY"]
APP.run(debug = APP.config["FLASK_DEBUG_MODE_ENABLED"])
However, when I open a single browser window and browse to the route, I get This is a new session.
When I open another browser window, and load the route, I get This is an existing session.
How is that possible? Shouldn't a session be unique per user? Thanks in advance for any clarification.