Ask coding questions

← Back to all posts
Help with Flask session

I'm using the standard session import from Flask, and I use sessions to store data! I use it for the login page, where it works perfectly fine, however when I use it for my Profile page, it doesn't retain the data set on the session. Here's my code:

However, when I use it for the profile page, it doesn't retain:

Here's my login.html code:

Here's my profile.html code:

I can't understand why it works for the login page and not for the profile page. I would like to know where I'm going wrong and what I can do to fix this error!


I've manually set my SECRET_KEY so I don't think thats a reason for the data not persisting either...