I am trying to write a custom django-admin command that executes a celery task, however the task doesn't execute and django just hangs when I try.
from django.core.management.base import BaseCommand
from myapp.tasks import my_celery_task
class Command(BaseCommand):
def handle(self, *args, **options):
print "starting task"
my_celery_task.delay()
print "task has been sent"
The output I receive when calling the command is:
starting task
I never reach the "task has been sent" line. It just hangs. I'm not sure why the task isn't running. Celery tasks are called perfectly when called by a view.
The issue was actually with RabbitMQ on Mac after upgrading to High Sierra.