"Database returned an invalid value in QuerySet.datetimes()" error when add a new language in Open edX

I was trying to add another language to my Open edX site in the Django's admin dashboard and this is what I got:

Internal Server Error: /admin/dark_lang/darklangconfig/
...

  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/expressions.py", line 927, in convert_value
    "Database returned an invalid value in QuerySet.datetimes(). "
ValueError: Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?

Oh crap... what's that?

Turns out it's an error of MySQL and Django. So, do the following to fix:

1. Populate the timezone definitions in the 'mysql' table

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

2. Flush tables

mysql -u root -p -e "flush tables;" mysql 


Reference: https://stackoverflow.com/questions/21351251/database-returned-an-invalid-value-in-queryset-dates

Comments