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

时间:2016-12-30 22:12:40

标签: mysql django google-app-engine paypal

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

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.none.myapplication, PID: 3881
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.none.myapplication/com.none.myapplication.MainActivity}: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteQuery: SELECT  * FROM oldDetails

我使用Google Mysql,我已经在Google Cloud Shell上尝试了这个答案solution1

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

1 个答案:

答案 0 :(得分:0)

实际上你用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;