gpt4 book ai didi

mysql - 数据库在 QuerySet.datetimes() 中返回无效值

转载 作者:行者123 更新时间:2023-11-29 19:40:08 25 4
gpt4 key购买 nike

当我尝试从管理站点访问 PayPal IPN 时,出现此错误。

ValueError at /admin/ipn/paypalipn/
Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?
Request Method: GET
Request URL: http://myapp.appspot.com/admin/ipn/paypalipn/
Django Version: 1.9
Exception Type: ValueError
Exception Value:
Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?
Exception Location: /base/data/home/apps/e~myapp/1.397535426774028716/lib/django/db/models/expressions.py in convert_value, line 945
Python Executable: /base/data/home/runtimes/python27/python27_dist/python
Python Version: 2.7.5
Python Path:
['/base/data/home/apps/e~myapp/1.397535426774028716',
'/base/data/home/apps/e~myapp/1.397535426774028716/lib',
'/base/data/home/runtimes/python27/python27_dist/lib/python27.zip',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/plat-linux2',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-tk',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-old',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-dynload',
'/base/data/home/runtimes/python27/python27_dist/lib/python2.7/site-packages',
'/base/data/home/runtimes/python27/python27_lib/versions/1',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.5',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/ssl-2.7',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/webob-1.1.1',
'/base/data/home/runtimes/python27/python27_lib/versions/third_party/yaml-3.10']
Server time: Fri, 30 Dec 2016 22:09:03 +0000

我使用 Google Mysql,并且尝试过这个答案 solution1在 Google Cloud Shell 上。

mysql> mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -u root -p 
-> "flush tables;"
-> flush tables;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'm
ysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -u root -p
"flush tabl' at line 1
mysql>

最佳答案

实际上,您在 Google 上搜索的解决方案应该可以正常工作,但您错误地执行了该操作。

我将在这里再次展示它们,但为了澄清一下,以下步骤都是从问题描述中复制的。

步骤:

  1. 系统命令行而不是 MySQL 的命令行界面中,键入 mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -uroot -p ,所以你会看到类似这样的内容:

    ubuntu@ubuntu$ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -uroot -p
  2. (可选)检查问题是否已解决。如果没有,请通过mysql -uroot -p输入MySQL命令行在您的系统中,然后输入 flush tables; 。您的屏幕将如下所示:

    ubuntu@ubuntu$ mysql -uroot -p
    Enter password:
    ...
    mysql> flush tables;

关于mysql - 数据库在 QuerySet.datetimes() 中返回无效值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41403320/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com