芹菜花展格林尼治标准时间而不是当地时区 [英] Celery Flower show GMT time instead local timezone

查看:68
本文介绍了芹菜花展格林尼治标准时间而不是当地时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过pip安装了Flower,一切正常,但是当我看到Flower中的任务时间时,它会显示GMT时间而不是时区中的时间.花任务选项

I've installed Flower via pip, all work's fine, but when i see task time in flower it show me GMT time instead time in timezone. Flower task options

  • Pythnon-3.4
  • Django-1.8.7
  • Redis服务器v = 2.8.17
  • 芹菜-3.1.19

我的芹菜和Django conf:

My celery and django conf:

TIME_ZONE = 'Europe/Moscow'
USE_I18N = True
USE_L10N = True
USE_TZ = True
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = 'Europe/Moscow'

我尝试更改TIME_ZONE,但是它什么也没做,或者设置了 CELERY_ENABLE_UTS = False 如果我更改芹菜时区属性-它在工作人员日志中已更改.服务器上的硬件时间也是13:52.

I've tried to change TIME_ZONE but it gives nothing, or set CELERY_ENABLE_UTS = False If i change celery timezone properties - it's changed in workers log. HW time on server is 13:52 too.

在工作日志中,时间显示正确.

In the worker log time is displayed correctly.

[2016-01-13 13:52:44,510: INFO/MainProcess] Received task: ***task[f652c89d-3f1b-4795-9e41-064ceb33b462]
[2016-01-13 13:52:45,529: INFO/MainProcess] Task ***task[f652c89d-3f1b-4795-9e41-064ceb33b462] succeeded in 1.0084812670002066s:

推荐答案

设置CELERY_ENABLE_UTC = False,如果您的芹菜版本高于3.0,那么请与芹菜节拍保持相同,并在所有时间表中正常使用.

setting CELERY_ENABLE_UTC = False, if your celery version is higher than 3.0 , so that keep same with celery beat and works well for all schedules.

CELERY_ENABLE_UTC = False

设置CELERY_TIMEZONE ='亚洲/上海'.这样花的时间才能很好地显示.

setting CELERY_TIMEZONE = 'Asia/Shanghai'. so that flower time display well.

CELERY_TIMEZONE ='Asia/Shanghai'

在Flask中,应通过以下方式将设置推送到conf obj中:celery.conf ['CELERY_ENABLE_UTC'] = CELERY_ENABLE_UTCcelery.conf ['CELERY_TIMEZONE'] = CELERY_TIMEZONE

in Flask, settings should be push into conf obj by: celery.conf['CELERY_ENABLE_UTC'] = CELERY_ENABLE_UTC celery.conf['CELERY_TIMEZONE'] = CELERY_TIMEZONE

这篇关于芹菜花展格林尼治标准时间而不是当地时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆