Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

Commit 5dba0b2

Browse files
committed
Add support for Heroku Redis
1 parent 6b1525c commit 5dba0b2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

flask_heroku.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ def init_app(self, app):
7474
app.config.setdefault('REDIS_HOST', url.hostname)
7575
app.config.setdefault('REDIS_PORT', url.port)
7676
app.config.setdefault('REDIS_PASSWORD', url.password)
77+
78+
# Heroku Redis
79+
redis_url = environ.get('REDIS_URL')
80+
if redis_url:
81+
url = urlparse(redis_url)
82+
app.config.setdefault('REDIS_HOST', url.hostname)
83+
app.config.setdefault('REDIS_PORT', url.port)
84+
app.config.setdefault('REDIS_PASSWORD', url.password)
7785

7886
# Mongolab
7987
mongolab_uri = environ.get('MONGOLAB_URI')

0 commit comments

Comments
 (0)