Heroku Django Celery: NameError: DATABASE name undefined

I follow this tutorial to get celery and django working for a hero.

However, I get this error in my logs when I put in the specified code for the worker:

2011-12-22T05:31:56+00:00 heroku[web.1]: Starting process with command `python canada/manage.py run_gunicorn -b "0.0.0.0:47336" -w 3`
2011-12-22T05:31:56+00:00 app[web.1]: Unexpected error: (<type 'exceptions.NameError'>, NameError("name 'DATABASES' is not defined",), <traceback object at 0x11a9560>)
2011-12-22T05:31:56+00:00 app[web.1]: Traceback (most recent call last):
2011-12-22T05:31:56+00:00 app[web.1]:   File "canada/manage.py", line 11, in <module>
2011-12-22T05:31:56+00:00 app[web.1]:     import settings
2011-12-22T05:31:56+00:00 app[web.1]:   File "/app/canada/settings.py", line 51, in <module>
2011-12-22T05:31:56+00:00 app[web.1]:     CELERY_RESULT_DBURI = DATABASES['default']
2011-12-22T05:31:56+00:00 app[web.1]: NameError: name 'DATABASES' is not defined
2011-12-22T05:31:57+00:00 heroku[slugc]: Slug compilation finished
2011-12-22T05:31:57+00:00 heroku[web.1]: State changed from starting to crashed
2011-12-22T05:31:58+00:00 heroku[web.1]: Process exited

My settings.py options look like

import djcelery

djcelery.setup_loader()

BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
CELERY_RESULT_DBURI = DATABASES['default']
...

When I synchronize before adding this line CELERY_RESULT_DBURI = DATABASES['default'], it works fine. According to the document

When you deploy the Django application, the compilation process adds the following code to your settings.py to use the DATABASE_URL environment variable:

+5
source share
2 answers

Heroku DATABASES settings.py, , DATABASES settings.py, .

Heroku DATABASES ( DATABASE_URL env, . django-heroku-template) buildpack.

+8

, :

export DATABASE_URL='postgres://postuser:postpassword@posthost/dbname'

- Heroku settings.py

0

All Articles