title: How to make django celery use the redis broker url?
body: <pre><code>(venv) [riyad@Fury django_celery]$ celery -A django_celery worker -l info
  &lt;Celery django_celery at 0x7f0917d57fa0&gt;
   
   -------------- celery@Fury v4.3.0 (rhubarb)
  ---- **** ----- 
  --- * ***  * -- Linux-5.8.6-1-MANJARO-x86_64-with-glibc2.2.5 2020-09-30 02:54:36
  -- * - **** --- 
  - ** ---------- [config]
  - ** ---------- .&gt; app:         django_celery:0x7f0917d57fa0
  - ** ---------- .&gt; transport:   amqp://guest:**@localhost:5672//
  - ** ---------- .&gt; results:     
  - *** --- * --- .&gt; concurrency: 4 (prefork)
  -- ******* ---- .&gt; task events: OFF (enable -E to monitor tasks in this worker)
  --- ***** ----- 
   -------------- [queues]
                  .&gt; celery           exchange=celery(direct) key=celery
                  
  
  [tasks]
    . django_celery.celery.debug_task
    . example.task.sleepy
  
  [2020-09-30 02:54:36,989: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
  Trying again in 2.00 seconds...
  
  [2020-09-30 02:54:38,996: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.
  Trying again in 4.00 seconds..
  </code></pre>
  <p>the main issue cause by this redis broker url, so far i am running a redis server on my other terminal. i am using two libraries redis and celery
  my settings.py file-&gt;</p>
  <pre><code>CACHES = {
      &quot;default&quot;: {
          &quot;BACKEND&quot;: &quot;django_redis.cache.RedisCache&quot;,
          &quot;LOCATION&quot;: &quot;redis://127.0.0.1:6379/1&quot;,
          &quot;OPTIONS&quot;: {
              &quot;CLIENT_CLASS&quot;: &quot;django_redis.client.DefaultClient&quot;
          },
          &quot;KEY_PREFIX&quot;: &quot;example&quot;
      }
  }
  BROKER_TRANSPORT = &quot;redis&quot;
  
  BROKER_HOST = &quot;localhost&quot;  # Maps to redis host.
  BROKER_PORT = 6379         # Maps to redis port.
  BROKER_VHOST = &quot;1&quot;         # Maps to database number.
  
  CELERY_RESULT_BACKEND = &quot;redis&quot;
  CELERY_REDIS_HOST = &quot;localhost&quot;
  CELERY_REDIS_PORT = 6379
  CELERY_REDIS_DB = 1
  </code></pre>
  <p>The default configuration from celery docs....all i am doing here is to make a celery instance an to work with the redis broker which can queue the task in redis broker and later fetch task from that my celery.py file-&gt;</p>
  <pre><code>import os
  
  from celery import Celery
  
  # set the default Django settings module for the 'celery' program.
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_celery.settings')
  
  app = Celery('django_celery')
  print(app)
  # Using a string here means the worker doesn't have to serialize
  # the configuration object to child processes.
  # - namespace='CELERY' means all celery-related configuration keys
  #   should have a `CELERY_` prefix.
  app.config_from_object('django.conf:settings', namespace='CELERY')
  
  # Load task modules from all registered Django app configs.
  app.autodiscover_tasks()
  
  
  @app.task(bind=True)
  def debug_task(self):
      print(f'Request: {self.request!r}')
  .
  </code></pre>
  <p>initializing the celery instance with django in main app my init.py file-&gt;</p>
  <pre><code>from __future__ import absolute_import, unicode_literals
  
  from .celery import app as celery_app
  
  __all__ = ('celery_app',)
  </code></pre>