Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RQ-Dashboard can no longer be integrated with Flask 2.3+ as a blueprint #417

Closed
born2discover opened this issue Apr 29, 2023 · 15 comments
Closed

Comments

@born2discover
Copy link

Hello,

app.before_first_request and blueprint.before_first_request have been deprecated in Flask 2.2.0 (pallets/flask#4605) and completely removed in version 2.3.0.

Therefore it is no longer possible for projects using Flask 2.3.0 to integrate rq-dashboard directly as an application blueprint. An attempt to do so will produce an AttributeError: 'Blueprint' object has no attribute 'before_app_first_request'.

@kennysong
Copy link

Our team has run into the same issue.

@mbhagdev
Copy link

mbhagdev commented May 2, 2023

Any workarounds or alternatives someone have for this issue?

@ArashHosseini
Copy link

+1

@kennysong
Copy link

@mbhagdev I saw that you seem to have a fork of RQ Dashboard – does your fork fix this issue?

@mbhagdev
Copy link

mbhagdev commented May 9, 2023

@mbhagdev I saw that you seem to have a fork of RQ Dashboard – does your fork fix this issue?
Yes, I removed the annotation in question and called it in when loading flask app
I have a PR to be merged back in #419
For usage in another flask app make sure to call that method now since its not automatically called like below using your flask app

app.config.setdefault('RQ_DASHBOARD_REDIS_URL', redis_url)
rq_dashboard.web.setup_rq_connection(app)

My fork is also published on pypi as rq-dashboard-compatible
pip install rq-dashboard-compatible

@kennysong
Copy link

Thanks @mbhagdev, confirmed that your fork works with flask==2.3.2!

Our team has created a separate fork internally that branches off of the 0.6.1 tag with the same changes, since your fork is based on master which has a completely different and new (?) UI.

@zhangguoqiang666
Copy link

+1

@zhangguoqiang666
Copy link

Traceback (most recent call last):
File "/usr/local/bin/rq-dashboard", line 5, in
from rq_dashboard.cli import main
File "/usr/local/lib/python3.8/dist-packages/rq_dashboard/init.py", line 3, in
from .web import blueprint
File "/usr/local/lib/python3.8/dist-packages/rq_dashboard/web.py", line 68, in
@blueprint.before_app_first_request
AttributeError: 'Blueprint' object has no attribute 'before_app_first_request'

@cjlapao
Copy link
Collaborator

cjlapao commented Jun 15, 2023

This should now be fixed with the latest merge, please confirm

@AriefBadal23
Copy link

I'm still getting the same error.

This should now be fixed with the latest merge, please confirm

@cjlapao
Copy link
Collaborator

cjlapao commented Jun 15, 2023

@AriefBadal23 did you compile it from the source or did you use the releases? we did not update the releases, just the source

@AriefBadal23
Copy link

@AriefBadal23 did you compile it from the source or did you use the releases? we did not update the releases, just the source

Oh I checked the released version, I will try the source then.

@cjlapao
Copy link
Collaborator

cjlapao commented Jun 19, 2023

@AriefBadal23 yes, the version has not been updated yet. we are working on automating this, will let you know once that automation if finalized, for now please use the source code

@mattiadri
Copy link

mattiadri commented Aug 18, 2023

This worked for me

pip install rq-dashboard-compatible

@cjlapao
Copy link
Collaborator

cjlapao commented Aug 30, 2023

@AriefBadal23 we have now the PyPi package updated, so you should be all fine. Update to the latest 0.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants