Ver Fonte

Mention timezone settings

Ask Solem há 12 anos atrás
pai
commit
9000f31d6f

+ 3 - 1
docs/configuration.rst

@@ -49,6 +49,8 @@ Time and date settings
 CELERY_ENABLE_UTC
 ~~~~~~~~~~~~~~~~~
 
+.. versionadded:: 2.5
+
 If enabled dates and times in messages will be converted to use
 the UTC timezone.
 
@@ -56,7 +58,7 @@ Note that workers running Celery versions below 2.5 will assume a local
 timezone for all messages, so only enable if all workers have been
 upgraded.
 
-Disabled by default.  UTC will be enabled by default in version 4.0.
+Enabled by default since version 3.0.
 
 .. setting:: CELERY_TIMEZONE
 

+ 18 - 0
docs/getting-started/next-steps.rst

@@ -629,6 +629,24 @@ and shows a list of online workers in the cluster::
 You can read more about the :program:`celery` command and monitoring
 in the :ref:`Monitoring Guide <guide-monitoring>`.
 
+Timezone
+========
+
+All times and dates, internally and in messages uses the UTC timezone.
+
+When the worker receives a message, for example with a countdown set it
+converts that UTC time to local time.  If you wish to use
+a different timezone than the system timezone then you must
+configure that using the :setting:`CELERY_TIMEZONE` setting.
+
+To use custom timezones you also have to install the :mod:`pytz` library::
+
+    $ pip install pytz
+
+Setting a custom timezone::
+
+    celery.conf.CELERY_TIMEZONE = 'Europe/London'
+
 Optimization
 ============
 

+ 5 - 0
examples/next-steps/proj/celery.py

@@ -5,3 +5,8 @@ from celery import Celery
 celery = Celery(broker='amqp://',
                 backend='amqp://',
                 include=['proj.tasks'])
+
+# Optional configuration, see the application user guide.
+celery.conf.update(
+    CELERY_TASK_RESULT_EXPIRES=3600,
+)