Pages

Showing posts with label celery. Show all posts
Showing posts with label celery. Show all posts

Tuesday, May 2, 2017

Django celery tasks timezone error

Django celery tasks timezone error


For some reason when I access the celerys tasks page in the Djangos admin (.../djcelery/taskstate/), I got this error:

Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?

I have to do the following to get rid of the error:

1. Uncomment these settings:

# CELERY_TIMEZONE = UTC
# CELERY_ENABLE_UTC = True

2. Add this under mysqld section in /etc/mysql/my.cnf:

default-time-zone = "+07:00"

3. Run the following command (without sudo):

$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p  mysql

4. Restart mysql:

$ sudo service mysql restart
Read more »