Please consider the following:
- This is the most important point, for flask session to work, you need to configure a
SECRET_KEY
, like below:
app.config["SECRET_KEY"] = 'YourSecretKey@123'
- I don't know, I just figured it out that you don't need the following line and it's corresponding import (it started working for me when I commented out this part, may be Flask-Session and Flask's inbuilt session are messing up with each other):
Session(app)
from flask_session import Session
- Don't directly update the session, if it's an array, do like below:
note = request.form.get("note")
temp = session['notes']
temp.append(note)
session['notes'] = temp
I hope, it will work for you.