如何在 django 芹菜配置中更改"transport"网址



我有django 3.2.7,芹菜5.2.1,redis 3.5.3

我有下一个芹菜设置。(REDIS_PASSWORD)是环境变量:

CELERY_BROKER_URL = f'redis://:{REDIS_PASSWORD}@redis:6379/4'
CELERY_BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 3600}
CELERY_RESULT_BACKEND = f'redis://:{REDIS_PASSWORD}@redis:6379/1'
CELERY_ACCEPT_CONTENT = ['application/json']

但是当我启动docker-compose应用程序时,它会显示

celery | --- ***** ----- 
celery | -- ******* ---- Linux-5.11.0-34-generic-x86_64-with-glibc2.31 2021-09-16 10:20:11
celery | - *** --- * --- 
celery | - ** ---------- [config]
celery | - ** ---------- .> app:         project:0x7f5cd0df0880
celery | - ** ---------- .> transport:   redis://redis:6379/0 <==== NO CHANGES HERE
celery | - ** ---------- .> results:     redis://:**@redis:6379/1
celery | - *** --- * --- .> concurrency: 16 (prefork)
celery | -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
celery | --- ***** ----- 

如何设置?

通过从docker-compose文件中删除环境参数来解决问题。

CELERY_BROKER_URL和CELERY_RESULT_BACKEND已分别更改为'broker_url'和'result_backend'。当我更改为env变量的新名称时,我可以编辑传输url。

最新更新