使用MySQL设置Django时,datetime值不正确 [英] Incorrect datetime value when setting up Django with MySQL

查看:304
本文介绍了使用MySQL设置Django时,datetime值不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Mac上设置MySQL的MySQL Django。这是我的设置:




  • Django 1.9

  • Mysql 5.6.23

  • OS X 10.11



对于数据通信,我使用MySQL连接器。



我修改了 settings.py 文件,以便Django可以和MySQL交谈。
问题是当我做 python manage.py migrate ,我不断收到这个错误:

  django.db.utils.DatabaseError:datetime值不正确:
'2016-01-11 06:59:07.980679 + 00:00'列1应用列。

这个datetime格式有什么问题?

解决方案

请转到项目目录下的settings.py,并将USE_TZ更改为false

  USE_TZ = False 


I am trying to set up Django with MySQL on a Mac. This is my setup:

  • Django 1.9
  • Mysql 5.6.23
  • OS X 10.11

For the data communication, I use MySQL Connector.

I have modified the settings.py file, so that Django can talk to MySQL. The problem is when I do python manage.py migrate, I keep getting this error:

django.db.utils.DatabaseError: Incorrect datetime value:
'2016-01-11 06:59:07.980679+00:00' for column 'applied' at row 1.

What is wrong with this datetime format?

解决方案

Please go to settings.py under your project directory and change USE_TZ to false

USE_TZ = False

这篇关于使用MySQL设置Django时,datetime值不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆