Use of flask-session, database connection pool, wtforms

1. Use of flask-session

The native session encrypts the data and puts it in the cookie. We can put the session in the database, redis, files...

Install:pip install flask-session

After using a third party, the usage is the same as before, except that some code is executed when the project starts.
method one:

conn = redis.Redis()
app.session_interface = RedisSessionInterface(conn, 'xxx') # 'xxx'是redis的key的前缀
# 我自己写的类有save_session和open_session---->操作redis存储和获取

Method 2: Flask integrates a third-party general solution, which is essentially the same (

Guess you like

Origin blog.csdn.net/BLee_0123/article/details/131819517