Search code examples
djangocelerydjango-celery

Why my celery task is not running?


I'm following this guide: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

My proj.celery file:

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from celery.schedules import crontab

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hc.settings')

app = Celery('hc')

app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()


@app.task
def debug_task(a):
    print a
app.conf.beat_schedule = {
    # Executes every Monday morning at 7:30 a.m.
    'debug-every-minute': {
        'task': 'tasks.debug_task',
        'schedule': crontab(),
        'args': ("BLa BLA BlA", ),
    },
}

also, I've added periodic task into /admin/django_celery_beat/

I understand that it's makes not sense to use both app.conf.beat_schedule and periodic_task in admin but I don't see expecting entries after

Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

(I expect that Bla bla will be written under that) Where I'm wrong?


Solution

  • Run celery by

    celery -A hc worker -B -l info