python - Django Celery email, celery is not working -
i working on django celery sending regsitration email ,but celery not working correct.
my error in celery
[2014-09-10 19:11:44,349: warning/mainprocess] celery@jeet-pc ready. [2014-09-10 19:13:38,586: info/mainprocess] received task: apps.kashmiri.tasks.signuptask[17ca2ae1-8c72-426c-babd-470a55ac19 5] [2014-09-10 19:13:38,936: error/worker-1] pool process <worker(worker-1, started)> error: runtimeerror(runtimeerror("app reg stry isn't ready yet.",), <function model_unpickle @ 0x034e4b30>, (('auth', 'user'), [], <function simple_class_factory @ x034e4af0>)) traceback (most recent call last): file "c:\python27\lib\site-packages\billiard\pool.py", line 289, in run sys.exit(self.workloop(pid=pid)) file "c:\python27\lib\site-packages\billiard\pool.py", line 350, in workloop req = wait_for_job() file "c:\python27\lib\site-packages\billiard\pool.py", line 441, in receive ready, req = _receive(1.0) file "c:\python27\lib\site-packages\billiard\pool.py", line 413, in _recv return true, loads(get_payload()) file "c:\python27\lib\site-packages\billiard\common.py", line 77, in pickle_loads return load(bytesio(s)) file "c:\python27\lib\site-packages\django\db\models\base.py", line 1450, in model_unpickle model = apps.get_model(*model_id) file "c:\python27\lib\site-packages\django\apps\registry.py", line 187, in get_model self.check_ready() file "c:\python27\lib\site-packages\django\apps\registry.py", line 119, in check_ready raise runtimeerror("app registry isn't ready yet.") runtimeerror: (runtimeerror("app registry isn't ready yet.",), <function model_unpickle @ 0x034e4b30>, (('auth', 'user'), [ , <function simple_class_factory @ 0x034e4af0>)) [2014-09-10 19:13:39,233: error/mainprocess] process 'worker-3' pid:7100 exited 'signal -1'
forms.py
from apps.kashmiri.tasks import signuptask signuptask.delay(user=user)
celery.py
from __future__ import absolute_import import os celery import celery django.conf import settings os.environ.setdefault('django_settings_module', 'kb.settings') app=celery('kb') app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.installed_apps) @app.task(bind= true) def debug_task(self): print('request:{0!r}'.format(self.request))
tasks.py
from __future__ import absolute_import celery.registry import tasks celery.task import task celery.app import shared_task django.utils.html import strip_tags django.core.mail import emailmultialternatives django.template.loader import render_to_string class signuptask(task): def run(self, user): subject, from_email, ='welcome kashmiri bhatta', 'info@seekersguru.com', user.email html_content = render_to_string('registration.html',{'user':user.email}) text_content= strip_tags(html_content) msg= emailmultialternatives(subject, text_content, from_email, [to]) msg.attach_alternative(html_content, "text/html") msg.send() tasks.register(signuptask)
when m using >> celery -a proj worker -l info
error runtimeerror: (runtimeerror("app registry isn't ready yet.",) please solving it..
this problem occurs django 1.7
. reported on github , fixed recenlty. upgrade latest version of celery. should solve problem
pip install celery --upgrade
Comments
Post a Comment