File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,24 @@ Flask-Redis
3
3
4
4
Adds Redis Support to Flask. Dead Simple.
5
5
6
+ Currently a single namespace within the configuration is supported.
7
+
8
+ ```
9
+ REDIS_URL="redis://localhost"
10
+ ```
11
+
12
+ with the Redis instance automatically loading variables from this namespace.
13
+
14
+ In the future, the ability to declare multiple Redis namespaces will be available
15
+
16
+ ```
17
+ REDIS_CACHE_URL="redis://localhost/0"
18
+ REDIS_METRICS_URL="redis://localhost/0"
19
+
20
+ redis_cache = Redis(config_prefix="REDIS_CACHE")
21
+ redis_metrics = Redis(config_prefix="REDIS_METRICS")
22
+ ```
23
+
6
24
## Installation
7
25
8
26
```
32
50
from flask import Flask
33
51
from flask_redis import Redis
34
52
35
- app = Flask(__name__)
36
53
redis = Redis()
37
- redis.init_app(app)
54
+
55
+ def create_app():
56
+ app = Flask(__name__)
57
+ redis.init_app(app)
58
+ return app
38
59
```
You can’t perform that action at this time.
0 commit comments