Celery raises ValueError: not enough values to unpack

后端 未结 5 1190
误落风尘
误落风尘 2021-01-31 00:00

Trying to run simple example with Celery and receiving an exception. RabbitMQ started in a Docker, also tried to start it locally. Celery works on a local Windows host



        
5条回答
  •  [愿得一人]
    2021-01-31 00:57

    I got this error on Windows 7 32bit system. So I did this to make it work.

    Add this

    `os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')` 
    

    before defining a celery instance in myproj/settings.py file in your django project.

    It should like like

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproj.settings')
    os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
    
    app = Celery('tasks', broker='redis://127.0.0.1:6379/0')
    

    I am using redis as a messaging broker so defined broker='redis://127.0.0.1:6379/0'

提交回复
热议问题