Problem with Celery and Django / Python

0

I am trying to implement a system of tasks with Celery in Django, but it is giving error and I do not know how to solve ...

Error appearing on console:

tasks.py

from __future__ import absolute_import, unicode_literals
from celery import task

from datetime import date



@task(ignore_result=True)
def verify_post_date(string):
    print(string)

settings.py

from celery.schedules import crontab
from datetime import timedelta


CELERY_ALWAYS_EAGER = True
CELERY_BROKER_URL = 'redis://localhost:6379/0'
#CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_TIMEZONE = 'America/Sao_Paulo'
CELERY_BEAT_SCHEDULE = {

    'verify_post_date': {
        'task': 'core.verify_post_date',
        'schedule': timedelta(seconds=10),

    },

}
    
asked by anonymous 12.10.2017 / 19:52

1 answer

0

Your task receives a 'string' parameter. So, to schedule it, you must pass this parameter through the 'args' key, as below:

'verify_post_date': {
    'task': 'core.verify_post_date',
    'schedule': timedelta(seconds=10),
    'args': ('teste')
}

I hope I have helped.

    
19.10.2017 / 04:31