redis 如何在django celery配置中更改“transport”url

4ioopgfo  于 2023-04-05  发布在  Redis
关注(0)|答案(2)|浏览(190)

我有django3.2.7,celery 5.2.1,redis3.5.3
我有下一个celery 设置。(REDIS_PASSWORD)是env变量:

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 | --- ***** -----

我该怎么设置呢?

fslejnso

fslejnso1#

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

k3bvogb1

k3bvogb12#

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

相关问题