Thursday, July 21, 2016

Unable to set up celery in supervisord

I'm trying to set up celery as a supervisord job (for my Django project) and getting an error. Most likely it's because of wrong import paths (or some other environment setting), but I have no idea what. Please help!

Here's my directory structure ('>' means down one level):

/home/ankush/jremind
>env
>jremind
>>celerybeat.pid  
>>celerybeat-schedule  
>>jremind  
>>manage.py  
>>remind  
>>requirements.txt
>logs
  
The supervisord conf file is:

command=/home/ankush/jremind/env/bin/celery --app=remind.celery:app worker --loglevel=INFO
environment=PYTHONPATH=/home/ankush/jremind/jremind
directory=/home/ankush/jremind/jremind
stdout_logfile=/home/ankush/jremind/logs/celeryd.log
stderr_logfile=/home/ankush/jremind/logs/celeryd.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600

Now, when I try to start the process, it exists too quickly, and I'm left with the following in the logs:

. . .
    self._conf = force_mapping(obj)
  File "/home/ankush/jremind/env/lib/python3.4/site-packages/celery/datastructures.py", line 50, in force_mapping
    if isinstance(m, (LazyObject, LazySettings)):
  File "/home/ankush/jremind/env/lib/python3.4/site-packages/django/utils/functional.py", line 204, in inner
    self._setup()
  File "/home/ankush/jremind/env/lib/python3.4/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/ankush/jremind/env/lib/python3.4/site-packages/django/conf/__init__.py", line 120, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

I'm not sure why I'm getting this error, because the secret key is most definitely there and the app runs fine. What am I doing wrong?

Best,
Ankush​

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALX%3DrKLVqMePZnsZ5SGRb4bqoyahAQOBbheWshH%2B5PXGdnQw%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment