from celery import Celery app = Celery('tasks', broker='redis://localhost:6379/0') @app.task def return_dtys(dtys_id): from .models import DTYSModel DTYSModel.objects.filter(id=dtys_id).update(is_stopped=False)