python - The SECRET_KEY setting must not be empty on Celery worker run -


django version 1.9.7.

my current project structure is:

vehicles/ ├── etl │   ├── etl │   ├── manage.py │   ├── pipeline │   └── bku └── web     ├── db.sqlite3     ├── manage.py     ├── profiles     ├── projects     ├── reverse     ├── static     ├── templates     ├── bku     │   ├── admin.py     │   ├── admin.pyc     │   ├── apps.py     │   ├── migrations     │   ├── models.py     │   ├── static     │   ├── templates     │   ├── tests.py     │   ├── urls.py     │   ├── views.py     │   └── views.pyc     └── rocket         ├── celery.py         ├── __init__.py         ├── settings         │   ├── base.py         │   ├── dev.py         │   ├── __init__.py         │   ├── local.py         │   ├── production.py         │   ├── test.py         ├── urls.py         ├── wsgi.py 

now want use celery in bku django app. when run worker celery -a rocket worker -l info following error django.core.exceptions.improperlyconfigured: secret_key setting must not empty.. have secret_key defined , didn't have error before trying celery.

how can run worker?

rocket/celery.py

from __future__ import absolute_import, unicode_literals import os celery import celery  os.environ.setdefault('django_settings_module', 'rocket.settings') app = celery('rocket') app.config_from_object('django.conf:settings', namespace='celery') app.autodiscover_tasks()  @app.task(bind=true) def debug_task(self):     print('request: {0!r}'.format(self.request)) 

rocket/init.py

from __future__ import absolute_import, unicode_literals .celery import app celery_app  __all__ = ['bku'] 

the error message bit misleading—usually when see improperlyconfigured exception means django can't find settings file.

in case you're setting django_settings_module environment variable rocket.settings, directory structure looks should instead rocket.settings.production.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -