Flask-And-Redis
Flask-And-Redis copied to clipboard
Init_app doesn't set self.app = app
Awesome plugin! However, I'm using the app factory pattern and I'm struggling to get it working. It seems to me that maybe self.app = app should be added in the init_app method?
For example in create_app()::
redis_object.init_app(app)
print(redis_object.get_app())
last row will throw RuntimeError: Flask application not registered on Redis instance and no applcation bound to current context.
Try this.
redis_object.init_app(app)
with app.app_context():
print(redis_object.get_app())
http://flask.pocoo.org/docs/1.0/appcontext/
It's been a while.
I'll take a look on the original issue and if only way for redis_object.get_app() to be called within app context, I'll point this in documentation.
Thanks for waiting on this.