I frequently use Django + MySql on a pristine Vagrant virtual machine. And on a fresh machine, for the first time, I had to manually load time zone information into mysql.
'runserver' refused to run, although 'python ./manage.py --help' ran fine (that is not a surprise - --help does not touch the database) 'runserver' said that a query failed, because of something being too old. I'm sorry that I cannot quote the error message now. But it would not run at all. The solution was to run mysql_tzinfo_to_sql <https://www.google.com/url?q=https%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2Fen%2Fmysql-tzinfo-to-sql.html&sa=D&sntz=1&usg=AFQjCNH8YJbKdB-R4TSqRnjFDA9KkagrBw> . >>> Does anyone understand why this is a problem now? I haven't changed anything in my requirements.txt. I suppose that my Ubuntu image for Virtual Box was upgraded recently and that might explain it. I'd like to understand why this happened. On Tuesday, November 14, 2017 at 8:35:28 PM UTC-5, Michael Lenaghan wrote: > > For MySQL the Django docs say > <https://docs.djangoproject.com/en/1.11/ref/databases/#time-zone-definitions> > : > > If you plan on using Django’s timezone support >> <https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/>, use >> mysql_tzinfo_to_sql >> <https://dev.mysql.com/doc/refman/en/mysql-tzinfo-to-sql.html> to load >> time zone tables into the MySQL database. This needs to be done just once >> for your MySQL server, not per database. > > > I can't find any evidence that Django actually uses those tables? > > Here > <https://github.com/django/django/blob/master/django/db/backends/mysql/operations.py#L164>, > > for example, is a snippet from adapt_datetimefield_value(): > > # MySQL doesn't support tz-aware datetimes >> if timezone.is_aware(value): >> if settings.USE_TZ: >> value = timezone.make_naive(value, >> self.connection.timezone) >> else: >> raise ValueError("MySQL backend does not support >> timezone-aware datetimes when USE_TZ is False.") > > > adapt_timefiled_value() is even simpler > <https://github.com/django/django/blob/master/django/db/backends/mysql/operations.py#L188> > : > > # MySQL doesn't support tz-aware times >> if timezone.is_aware(value): >> raise ValueError("MySQL backend does not support >> timezone-aware times.") > > > What am I missing? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f502ca14-2342-45b6-810a-9f9bbec11da2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.