'django celery error: AttributeError: 'EntryPoint' object has no attribute 'module_name'
i am extremely new to django-celery, its doc have been confusing to me and i have been following tutorial, here is just a basic setup and i have encountered a untrackable error for me, the error is:
AttributeError: 'EntryPoint' object has no attribute 'module_name'
full traceback:
Traceback (most recent call last):
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/app/base.py", line 1250, in backend
return self._local.backend
AttributeError: '_thread._local' object has no attribute 'backend'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/bootsteps.py", line 112, in start
self.on_start()
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/apps/worker.py", line 136, in on_start
self.emit_banner()
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/apps/worker.py", line 170, in emit_banner
' \n', self.startup_info(artlines=not use_image))),
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/apps/worker.py", line 232, in startup_info
results=self.app.backend.as_uri(),
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/app/base.py", line 1252, in backend
self._local.backend = new_backend = self._get_backend()
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/app/base.py", line 955, in _get_backend
backend, url = backends.by_url(
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/app/backends.py", line 69, in by_url
return by_name(backend, loader), url
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/app/backends.py", line 47, in by_name
aliases.update(load_extension_class_names(extension_namespace))
File "/home/muhammad/Desktop/celery/env/lib/python3.8/site-packages/celery/utils/imports.py", line 146, in load_extension_class_names
yield ep.name, ':'.join([ep.module_name, ep.attrs[0]])
AttributeError: 'EntryPoint' object has no attribute 'module_name'
the celery.py, init.py and and task are just the basic: init.py:
from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app
__all__ = ('celery_app',)
celery.py:
from __future__ import absolute_import, unicode_literals
from celery import Celery
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
app = Celery('core')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
task.py:
from celery import shared_task
@shared_task(bind=True)
def add(x, y):
return x + y
settings conf for celery is:
CELERY_BROKER_URL = 'localhost'
CELERY_ACCEPT_CONTENT = ['json',]
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_BACKEND = 'django-db'
also i have installed and added django_celery_result in INSTALLED APPS
INSTALLED_APPS = [
...
'celery_practice',
'django_celery_results'
]
For your information, rabbitmq-server is running on localhost thats why i have set BROKER_URL TO 'localhost':
rabbitmq-server.service - RabbitMQ Messaging Server
Loaded: loaded (/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-04-03 16:14:04 PKT; 24h ago
Main PID: 1005 (beam.smp)
Status: "Initialized"
Tasks: 91 (limit: 9090)
any help would be appreciated thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
