You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/installation.rst
+9-4
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,19 @@ Install from PyPI using an installer such as pip:
10
10
11
11
Flask-Session's only required dependency is msgspec for serialization, which has no sub-dependencies.
12
12
13
-
You need to choose a storage type and install an appropriate client library so the app can communicate with storage. For example, if you want to use Redis as your storage, you will need to install the redis-py client library:
13
+
However, you also need to choose a storage type and install an appropriate client library so the app can communicate with storage. For example, if you want to use Redis as your storage, you will need to install the redis-py client library:
14
14
15
15
.. code-block:: bash
16
16
17
17
$ pip install redis
18
18
19
19
Redis is the recommended storage type for Flask-Session, as it has the most complete support for the features of Flask-Session with minimal configuration.
20
20
21
+
.. warning::
22
+
23
+
Flask-Session versions below 1.0.0 (not yet released), use pickle_ as the default serializer, which may have security implications in production if your storage is ever compromised.
24
+
25
+
21
26
Direct support
22
27
---------------
23
28
@@ -60,7 +65,7 @@ Flask-Session also indirectly supports storage and client libraries via cachelib
60
65
* - Redis
61
66
- redis-py_
62
67
* - Memcached
63
-
- pylibmc_, memcached, libmc_ or `google.appengine.api.memcached`_
68
+
- pylibmc_, python-memcached_, libmc_ or `google.appengine.api.memcached`_
64
69
* - MongoDB
65
70
- pymongo_
66
71
* - DynamoDB
@@ -69,10 +74,10 @@ Flask-Session also indirectly supports storage and client libraries via cachelib
69
74
70
75
.. warning::
71
76
72
-
As of writing, cachelib_ still uses pickle_ as the default serializer, which may have security implications in production.
77
+
As of writing, cachelib_ still uses pickle_ as the default serializer, which may have security implications in production if your storage is ever compromised.
Copy file name to clipboardexpand all lines: docs/usage.rst
+6-5
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ then create the :class:`Session` object by passing it the application.
18
18
app = Flask(__name__)
19
19
20
20
SESSION_TYPE='redis'
21
+
SESSION_REDIS= Redis(host='localhost', port=6379)
21
22
app.config.from_object(__name__)
22
23
Session(app)
23
24
@@ -47,21 +48,21 @@ Rather than calling :class:`~Session`, you may initialize later using :meth:`~Se
47
48
48
49
.. code-block:: python
49
50
51
+
...
50
52
sess = Session()
51
53
sess.init_app(app)
52
54
53
55
Or, if you prefer to directly set parameters rather than using the configuration constants, you can initialize by setting an instance of :class:`flask_session.redis.RedisSessionInterface` directly to the :attr:`flask.Flask.session_interface`.
54
56
55
57
.. code-block:: python
56
58
59
+
from flask import Flask, session
57
60
from flask_session.redis import RedisSessionInterface
0 commit comments