Django cookiecutter Project code won't run

581 Views Asked by At

I'm currently working on a django project built with django cookiecutter. I'm running both redis server and the redis client but anytime I run the django server it keeps giving the below error

raise ImproperlyConfigured(error_msg)
django.core.exceptions.ImproperlyConfigured: Set the CELERY_BROKER_URL environment variable

Below is the configurations of my .env file in my config folder

DEBUG=True
SECRET_KEY=12345
EMAIL_USE_TLS=True
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
[email protected]
EMAIL_HOST_PASSWORD=**********
[email protected]
BRAINTREE_MERCHANT_ID=5pbrjk4gmztd5m8k6dg
BRAINTREE_PUBLIC_KEY=by84t6rfx9nz3vs6kegw
BRAINTREE_PRIVATE_KEY=202056899b37713b1faeb093207160ff2e
BROKER_URL=amqp://
CELERY_RESULT_BACKEND=db+sqlite:///results.sqlite
1

There are 1 best solutions below

1
On BEST ANSWER

I think you need to setting.py Configure celery in the file_ BROKER_ URL, as follows:

CELERY_BROKER_URL = 'redis://hostname:6379/6'

The last bit 6 is the number represents the databases of Redis, 0-15 is available.