简体   繁体   中英

Best way to hold variables in flask

I used Flask's g variable to store variables. I hosted the app in IIS, the values are not working correct and some time previously edited values were shown. Then I moved to sessions to hold my data. In my case I should not use database for storing my data. For each session I have more than 10 variables. Whether it is good to hold the data in session? or storing variables globally across request is good in production environment, if yes, anyone please explain? Also I would like mention that global declaration of variables not working correct in production environment for me.

I am using flask for a long time and the session approach works great for me. Still, there are some security concerns because you are storing information in your session cookie which is easy to decrypt. If the data are not sensitive like passwords I strongly suggest using session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM