[cubicweb/pyramid] add redis support in pyramid.ini
authorArthur Lutz <arthur.lutz@logilab.fr>
Fri, 27 Jan 2017 15:06:55 +0100
changeset 113 e7bdd07a067a
parent 112 308bde45ba1e
child 114 55fdd58090b4
[cubicweb/pyramid] add redis support in pyramid.ini
cubicweb/pyramid/pyramid.ini
pillar.example
--- a/cubicweb/pyramid/pyramid.ini	Thu Jan 26 16:33:29 2017 +0100
+++ b/cubicweb/pyramid/pyramid.ini	Fri Jan 27 15:06:55 2017 +0100
@@ -12,3 +12,12 @@
 cubicweb.auth.authtkt.session.secure = False
 cubicweb.auth.authtkt.persistent.secret = {{ config.pyramid.authtk_persistent_secret }}
 cubicweb.auth.authtkt.persistent.secure = False
+
+{% if 'redis_sessions_secret' in config.pyramid and config.pyramid.redis_sessions_secret %}
+redis.sessions.secret = {{ config.pyramid.redis_sessions_secret }}
+redis.sessions.timeout = 1200
+redis.sessions.prefix = {{ config.pyramid.get('redis_prefix', 'cw') }}:
+redis.sessions.url = {{ config.pyramid.get('redis_url', 'redis://localhost:6379/0') }}
+#redis.sessions.serialize = json.dumps
+#redis.sessions.deserialize = json.loads
+{% endif %}
\ No newline at end of file
--- a/pillar.example	Thu Jan 26 16:33:29 2017 +0100
+++ b/pillar.example	Fri Jan 27 15:06:55 2017 +0100
@@ -73,6 +73,9 @@
         authtk_persistent_secret: CHANGEME
         #includes:
         #  - cubes.app.extra
+        #redis_sessions_secret: CHANGEME
+        #redis_url: redis://localhost:6379/0
+        #redis_prefix: myapp
     demo2:
       database:
         name: cw_demo2