django使用celery时,python manage.py celery worker --loglevel=info报错redis.cache错误

仲和韵
2023-12-01

python manage.py celery worker -c 4 --loglevel=info

/usr/local/lib/python3.5/dist-packages/django/core/management/base.py:259: RemovedInDjango19Warning: “requires_model_validation” is deprecated in favor of “requires_system_checks”.
RemovedInDjango19Warning)

Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/django/core/cache/init.py”, line 84, in _create_cache
backend_cls = import_string(backend)
File “/usr/local/lib/python3.5/dist-packages/django/utils/module_loading.py”, line 26, in import_string
module = import_module(module_path)
File “/usr/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “manage.py”, line 10, in
execute_from_command_line(sys.argv)
File “/usr/local/lib/python3.5/dist-packages/django/core/management/init.py”, line 338, in execute_from_command_line
utility.execute()
File “/usr/local/lib/python3.5/dist-packages/django/core/management/init.py”, line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/usr/local/lib/python3.5/dist-packages/djcelery/management/commands/celery.py”, line 23, in run_from_argv
[’{0[0]} {0[1]}’.format(argv)] + argv[2:],
File “/usr/local/lib/python3.5/dist-packages/celery/bin/celery.py”, line 793, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File “/usr/local/lib/python3.5/dist-packages/celery/bin/base.py”, line 311, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File “/usr/local/lib/python3.5/dist-packages/celery/bin/celery.py”, line 785, in handle_argv
return self.execute(command, argv)
File “/usr/local/lib/python3.5/dist-packages/celery/bin/celery.py”, line 717, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File “/usr/local/lib/python3.5/dist-packages/celery/bin/worker.py”, line 179, in run_from_argv
return self(*args, **options)
File “/usr/local/lib/python3.5/dist-packages/celery/bin/base.py”, line 274, in call
ret = self.run(*args, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/celery/bin/worker.py”, line 212, in run
state_db=self.node_format(state_db, hostname), **kwargs
File “/usr/local/lib/python3.5/dist-packages/celery/worker/init.py”, line 95, in init
self.app.loader.init_worker()
File “/usr/local/lib/python3.5/dist-packages/celery/loaders/base.py”, line 129, in init_worker
self.on_worker_init()
File “/usr/local/lib/python3.5/dist-packages/djcelery/loaders.py”, line 132, in on_worker_init
self.close_cache()
File “/usr/local/lib/python3.5/dist-packages/djcelery/loaders.py”, line 99, in close_cache
cache.cache.close()
File “/usr/local/lib/python3.5/dist-packages/django/core/cache/init.py”, line 131, in getattr
return getattr(caches[DEFAULT_CACHE_ALIAS], name)
File “/usr/local/lib/python3.5/dist-packages/django/core/cache/init.py”, line 113, in getitem
cache = _create_cache(alias)
File “/usr/local/lib/python3.5/dist-packages/django/core/cache/init.py”, line 87, in _create_cache
“Could not find backend ‘%s’: %s” % (backend, e))
django.core.cache.backends.base.InvalidCacheBackendError: Could not find backend ‘redis_cache.cache.RedisCache’: No module named ‘redis_cache’

 类似资料: