Как настроить Celery и Heroku Redis

Я создал Heroku Redis на своей Dashboard и хочу использовать его.

Host <x>.compute-1.amazonaws.com
User 
Port <y>
Password <x>
URI redis://:<x>.compute-1.amazonaws.com:<y>

И я побежал

pip install celery
pip install redis

Здесь мне нужно использовать его, для чего я использовал URI, который выдает ошибку.

ModuleNotFoundError: No module named 'url'

settings.py

# CELERY STUFF
BROKER_URL = 'url'
CELERY_RESULT_BACKEND = 'url'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Africa/Nairobi'

celery.py

from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.settings')
app = Celery('portfolio')

# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

@app.task(bind=True)
def debug_task(self):
    print('Request: {0!r}'.format(self.request))

init.py

from __future__ import absolute_import

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
Вернуться на верх