我正在尝试使用celery-progress模块来向用户显示任务的进度,因为它需要很多时间来完成任务。但是,按照https://github.com/czue/celery-progress上的说明操作后,我在前端看到以下错误:-
NoReverseMatch at /netadc/arista/views/getFabListArista/TRCW/ Reverse for 'task_status' with arguments '('',)' not found. 1 pattern(s) tried: [u'celery_progress/(?P<task_id>[\\w-]+)/$'] Request Method: GET Request URL: http://x.x.x.x/netadc/arista/views/getFabListArista/TRCW/ Django Version: 1.11 Exception Type: NoReverseMatch Exception Value:
Reverse for 'task_status' with arguments '('',)' not found. 1 pattern(s) tried: [u'celery_progress/(?P<task_id>[\\w-]+)/$']
前端var progressUrl = "{% url 'celery_progress:task_status' task_id %}";上的网址模式不起作用。当我将它更改为var progressUrl = "{% url 'celery_progress:task_status' 'task_id' %}";时,我没有得到这个错误,但是没有任务在运行。
任何django/python方面的专家,请帮助。
发布于 2018-12-02 14:01:11
您必须将celery_progress的url映射添加到您的主urls.py。它在项目自述文件的前提条件部分进行了描述。
发布于 2021-03-19 17:04:46
点击这里:https://github.com/czue/celery-progress/issues/27
这表示任务ID为空。解决问题的最好方法是尝试找出为什么它是空白的。这可能是因为您的后端没有正确配置,所以没有从异步调用中分配/返回ID,因为您没有正确地将其从视图传递到模板,因为您在模板中引用了错误的变量,等等。
我建议您深入了解ID为空的原因,希望这将引导您找到合适的解决方案。
https://stackoverflow.com/questions/52937660
复制相似问题