[Python] Problema com Celery e Django/Python

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    Estou tentando implementar um sistema de tasks com Celery no Django, mas está dando erro e eu não sei como resolver...

    Erro que aparece no console:

    [​IMG]

    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),

    },

    }

    Continue reading...

Compartilhe esta Página