Debian Codegraph @

docs/installation.rst

raw
1
2 Installation
3 ============
4
5 Install from PyPI using an installer such as pip:
6
7 .. code-block:: bash
8
9 $ pip install Flask-Session
10
11 Flask-Session's only required dependency is msgspec for serialization, which has no sub-dependencies.
12
13 However, you also need to choose a storage type and install an appropriate client library so the app can communicate with storage.
14 For example, if you want to use Redis as your storage, you will need to install the redis-py_ library either directly or as an optional dependency like below:
15
16 .. code-block:: bash
17
18 $ pip install Flask-Session[redis]
19
20 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.
21
22 .. warning::
23
24 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.
25
26
27 Available storage options
28 ^^^^^^^^^^^^^^^^^^^^^^^^^
29
30 To install Flask-Session with support for a specific storage backend, use the following command, replacing ``<storage-option>`` with your chosen backend from the list below:
31
32 .. code-block:: bash
33
34 pip install Flask-Session[<storage-option>]
35
36 Available storage options and their corresponding ``<storage-option>`` values are:
37
38
39 .. list-table::
40 :header-rows: 1
41 :align: left
42
43 * - Storage
44 - <storage-option>
45 - Default client library
46 - Alternative client libraries
47 * - **Redis**
48 - ``redis``
49 - redis-py_
50 -
51 * - **Memcached**
52 - ``memcached``
53 - pymemcache_
54 - pylibmc_, python-memcached_, libmc_
55 * - **MongoDB**
56 - ``mongodb``
57 - pymongo_
58 -
59 * - **CacheLib**
60 - ``cachelib``
61 - cachelib_
62 -
63 * - **SQLAlchemy**
64 - ``sqlalchemy``
65 - flask-sqlalchemy_
66 -
67 * - **DynamoDB**
68 - ``dynamodb``
69 - boto3_
70 -
71
72 Other storage backends might be compatible with Flask-Session as long as they adhere to the command interfaces used by the libraries listed above.
73
74 Cachelib
75 --------
76
77 Flask-Session also indirectly supports storage and client libraries via cachelib_, which is a wrapper around various cache libraries.
78 You must also install cachelib_ itselfand the relevant client library to use these.
79
80 .. list-table::
81 :header-rows: 1
82 :align: left
83
84 * - Storage
85 - Client Library
86 * - File System
87 - Not required
88 * - Simple Memory
89 - Not required
90 * - UWSGI
91 - uwsgi_
92 * - Redis
93 - redis-py_
94 * - Memcached
95 - pylibmc_, python-memcached_, libmc_ or `google.appengine.api.memcached`_
96 * - MongoDB
97 - pymongo_
98 * - DynamoDB
99 - boto3_
100
101
102 .. warning::
103
104 As of writing, cachelib_ still uses pickle_ as the default serializer, which may have security implications in production if your storage is ever compromised.
105
106
107 .. _redis-py: https://github.com/redis/redis-py
108 .. _pylibmc: http://sendapatch.se/projects/pylibmc/
109 .. _python-memcached: https://github.com/linsomniac/python-memcached
110 .. _pymemcache: https://github.com/pinterest/pymemcache
111 .. _pymongo: https://pymongo.readthedocs.io/en/stable
112 .. _flask-sqlalchemy: https://github.com/pallets-eco/flask-sqlalchemy
113 .. _cachelib: https://cachelib.readthedocs.io/en/stable/
114 .. _google.appengine.api.memcached: https://cloud.google.com/appengine/docs/legacy/standard/python/memcache
115 .. _boto3: https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
116 .. _libmc: https://github.com/douban/libmc
117 .. _uwsgi: https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
118 .. _pickle: https://docs.python.org/3/library/pickle.html