'Celery 4.0.0: No such transport: django

I followed the "First steps with Django" tutorial for Celery 4.0.0: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html

This all works as expected. However, if I then try to change the transport from AMQP to the Django ORM by adding this to the end of settings.py:

CELERY_BROKER_URL = 'django://'

Then when I run the worker process (celery -A proj worker), I get an error:

Traceback (most recent call last):
  File "/home/ac/src/proj/.pyenv/bin/celery", line 11, in <module>
    sys.exit(main())
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/__main__.py", line 14, in main
    _main()
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 326, in main
    cmd.execute_from_commandline(argv)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 488, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/base.py", line 278, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 480, in handle_argv
    return self.execute(command, argv)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/celery.py", line 412, in execute
    ).run_from_argv(self.prog_name, argv[1:], command=argv[0])
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/worker.py", line 221, in run_from_argv
    return self(*args, **options)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/base.py", line 241, in __call__
    ret = self.run(*args, **kwargs)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/bin/worker.py", line 255, in run
    **kwargs)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/worker/worker.py", line 99, in __init__
    self.setup_instance(**self.prepare_args(**kwargs))
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/worker/worker.py", line 120, in setup_instance
    self._conninfo = self.app.connection_for_read()
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/app/base.py", line 732, in connection_for_read
    return self._connection(url or self.conf.broker_read_url, **kwargs)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/celery/app/base.py", line 808, in _connection
    'broker_connection_timeout', connect_timeout
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/kombu/connection.py", line 179, in __init__
    if not get_transport_cls(transport).can_parse_url:
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/kombu/transport/__init__.py", line 81, in get_transport_cls
    _transport_cache[transport] = resolve_transport(transport)
  File "/home/ac/src/proj/.pyenv/local/lib/python2.7/site-packages/kombu/transport/__init__.py", line 62, in resolve_transport
    raise KeyError('No such transport: {0}'.format(transport))
KeyError: u'No such transport: django'

What am I doing wrong?



Solution 1:[1]

There is no a transport called django so you can not use django://. What you may use instead is RabbitMQ like this:

CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'

Solution 2:[2]

I had this problem when converting to use split-settings and environs. I had left the quotes from the settings file, and environs doesn't like quotes.

Print/log the values you provide to Connect (values from settings.py). Check that you don't have extraneous symbols (quotes).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ChuckCottrill