Error connecting django-rq: ImportError: cannot import name get_failed_queue

Error connecting django-rq: ImportError: cannot import name get_failed_queue

从未与 django-rqredis 合作过。这个问题应该很容易解决,我想,但我不知道如何。

当我启动服务器时,出现此错误ImportError: cannot import name get_failed_queue

我用的是Python 2.7

完整回溯

Unhandled exception in thread started by <function wrapper at 0x7f8d45706410>
Traceback (most recent call last):
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
    self.check(display_num_errors=True)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    for pattern in resolver.url_patterns:
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/m0nte-cr1st0/work_projects/startapp/finbee/finbee/urls.py", line 27, in <module>
    url(r'^admin/rq/', include('django_rq_dashboard.urls')),
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 52, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django_rq_dashboard/urls.py", line 3, in <module>
    from . import views
  File "/home/m0nte-cr1st0/.virtualenvs/finbee/local/lib/python2.7/site-packages/django_rq_dashboard/views.py", line 16, in <module>
    from rq import Queue, Worker, get_failed_queue, push_connection
ImportError: cannot import name get_failed_queue

包裹清单

aenum                           2.1.2    
appdirs                         1.4.3    
asn1crypto                      0.24.0   
bcrypt                          3.1.6    
cached-property                 1.5.1    
certifi                         2019.3.9 
cffi                            1.12.3   
chardet                         3.0.4    
Click                           7.0      
croniter                        0.3.30   
cryptography                    2.7      
dbf                             0.96.8   
defusedxml                      0.6.0    
Django                          1.9.13   
django-admin-extensions         0.10.0   
django-appconf                  1.0.3    
django-autocomplete-light       3.3.5    
django-debug-toolbar            1.4      
django-filebrowser-no-grappelli 3.7.8    
django-flat-theme               1.1.4    
django-imagekit                 4.0.2    
django-nested-inline            0.3.7    
django-pipeline                 1.6.12   
django-rq                       2.0      /home/m0nte-cr1st0/.virtualenvs/finbee/src/django-rq 
django-rq-dashboard             0.3.0    
django-selectable               0.9.0    
django-static-sitemaps          4.2.1    
django-tinymce                  2.8.0    
django-treebeard                4.3      
django-uuslug                   1.1.8    
django-widget-tweaks            1.4.1    
djlime                          0.0.36   /home/m0nte-cr1st0/.virtualenvs/finbee/src/djlime/src
EasyProcess                     0.2.7    
enum34                          1.1.6    
Fabric                          1.10.2   
factory-boy                     2.5.2    
fake-useragent                  0.1.5    
html5lib                        1.0.1    
idna                            2.8      
ipaddress                       1.0.22   
isodate                         0.6.0    
lxml                            3.7.1    
paramiko                        2.4.2    
patool                          1.12     
pilkit                          2.0      
Pillow                          6.0.0    
pip                             19.1.1   
pkg-resources                   0.0.0    
psycopg2                        2.8.2    
pyasn1                          0.4.5    
pycparser                       2.19     
PyNaCl                          1.3.0    
python-dateutil                 2.8.0    
python-slugify                  3.0.2    
pytz                            2019.1   
pyunpack                        0.1.2    
redis                           3.2.1    
requests                        2.22.0   
requests-toolbelt               0.9.1    
rq                              1.0      
rq-scheduler                    0.6.0    
setuptools                      41.0.1   
simplejson                      3.16.0   
six                             1.12.0   
sqlparse                        0.3.0    
text-unidecode                  1.2      
urllib3                         1.25.3   
webencodings                    0.5.1    
wheel                           0.33.4   
zeep                            1.1.0    

感谢关注

发生这种情况是因为您使用的 django-rq==2.0 需要 rq>=1.0。函数 get_failed_queue() 不再存在于 rq==1.0 中,请阅读发行说明以了解如何更改代码以使其再次运行:https://github.com/rq/rq/releases/tag/v1.0

否则,你可以降级到django-rq==1.3.1和rq==0.13