Skip to content

Instantly share code, notes, and snippets.

@lauris
Created August 15, 2014 16:21
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lauris/241479d953012a2cadc7 to your computer and use it in GitHub Desktop.
Save lauris/241479d953012a2cadc7 to your computer and use it in GitHub Desktop.
Fix Django timezones issue: "Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?"
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
@sondt166
Copy link

sondt166 commented Nov 2, 2022

Thanks, you saved my day :D

@philippeowagner
Copy link

Perfect!

@kevinadhiguna
Copy link

kevinadhiguna commented Jan 25, 2024

Cheers!
This also worked to solve ValueError: Database returned an invalid datetime value. Are time zone definitions for your database installed? error

In my case, it happened when visiting access logs in django-defender admin panel though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment