Unable to load blueprint
davidmurray opened this issue · 7 comments
Hi,
When I try to load the blueprint in the following way:
from rqmonitor.bp import monitor_blueprint
app.register_blueprint(monitor_blueprint, url_prefix="/dashboard")
from .backend import config
app.config["RQ_MONITOR_REDIS_URL"] = config.REDIS_URL # This looks like : f"redis://:{REDIS_PASSWORD}@{REDIS_IP}:{REDIS_PORT}/0"
app.config["RQ_MONITOR_REFRESH_INTERVAL"] = 10
I get the following HTTP reponse when I try to load the page:
{"message":"RQ Monitor Global Exception","traceback":" File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 1950, in full_dispatch_request\n rv = self.dispatch_request()\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 1936, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 32, in _wrapper\n raise RQMonitorException(**kwargs).with_traceback(tb)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 22, in _wrapper\n inner_response = func(*args, **kwargs)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 11, in _wrapper\n _rendered_template = func(*args, **kwargs)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/bp.py\", line 99, in home\n site_map[rule.endpoint] = url_for(rule.endpoint)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/helpers.py\", line 370, in url_for\n return appctx.app.handle_url_build_error(error, endpoint, values)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 2216, in handle_url_build_error\n reraise(exc_type, exc_value, tb)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/_compat.py\", line 39, in reraise\n raise value\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/helpers.py\", line 358, in url_for\n endpoint, values, method=method, force_external=external\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/werkzeug/routing.py\", line 2179, in build\n raise BuildError(endpoint, values, method, self)\n"}
Why is that?
Thanks!
David
Hi David,
There are some issues occuring while importing the monitor_blueprint (my bad, didn't check for it previously). Although above seems not be directly related to static file issue #7 but I was able to reproduce some kind of url Build error as above while configuring for static_url_path for blueprint. I am looking more into it.
Hi David,
v1.0.0 should have fixed this. I checked with above example and it works fine now. Let me know if same error pops up again. Also as refresh interval is in ms and I think you want 10 seconds for RQ_MONITOR_REFRESH_INTERVAL so you should use 10000 for the same.
Hi,
Thanks for the info. I'll have a go at this new version next week and I'll update this issue. Also, thanks for the tip about the refresh interval !
Regards.
David
@pranavgupta1234 Unfortunately, I am still getting the same error with rqmonitor 1.0.0:
{"message":"RQ Monitor Global Exception","traceback":" File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 1950, in full_dispatch_request\n rv = self.dispatch_request()\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 1936, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 32, in _wrapper\n raise RQMonitorException(**kwargs).with_traceback(tb)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 22, in _wrapper\n inner_response = func(*args, **kwargs)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/decorators.py\", line 11, in _wrapper\n _rendered_template = func(*args, **kwargs)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/rqmonitor/bp.py\", line 99, in home\n site_map[rule.endpoint] = url_for(rule.endpoint)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/helpers.py\", line 370, in url_for\n return appctx.app.handle_url_build_error(error, endpoint, values)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/app.py\", line 2216, in handle_url_build_error\n reraise(exc_type, exc_value, tb)\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/_compat.py\", line 39, in reraise\n raise value\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/flask/helpers.py\", line 358, in url_for\n endpoint, values, method=method, force_external=external\n File \"/home/poga/anaconda3/envs/analyses_images/lib/python3.7/site-packages/werkzeug/routing.py\", line 2179, in build\n raise BuildError(endpoint, values, method, self)\n"}```
Same error for me too.
Hi @davidmurray @sti2dSinBastia
The issue was due to accessing app level rules for generating site_map. I have added check to filter only rqmonitor specific endpoints to be included in site_map in eac9f6a
Give it a go by directly installing from master, it should have fixed this issue.
It works ! Thank you, Very good job !