我已经完成了这个,这个并遵循了这个领域的文档,但我仍然收到错误。我不知道如何调试它。最后追溯。
更新:使用 MySQL 后端是罪魁祸首。SQLite3 很好,但是传入 django 后端 MySQL 编译器代码的查询数据什么都不返回,并且当它自己执行时,返回一个错误。其他人有这个问题,是否有解决方法,或者我完全错了?
重现步骤:
使用 MySQL 作为数据库。
访问以下视图:
from zinnia.views.archives import EntryIndex
url(r'^testing',
EntryIndex.as_view(),
name='zinnia_entry_archive_index'),
输入一个博客。
刷新视图。
繁荣。
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, *args, **kwargs)
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 333, in get
self.date_list, self.object_list, extra_context = self.get_dated_items()
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 415, in get_dated_items
date_list = self.get_date_list(qs, ordering='DESC')
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/views/generic/dates.py", line 394, in get_date_list
if date_list is not None and not date_list and not allow_empty:
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/query.py", line 100, in __nonzero__
self._fetch_all()
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/query.py", line 857, in _fetch_all
self._result_cache = list(self.iterator())
File "/opt/envs/django16/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1113, in results_iter
raise ValueError("Database returned an invalid value "
Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?
我已将其追溯到zinnia.views.archives.EntryIndex.as_view
,但还看不到发生了什么。有人有什么想法吗?我正在运行百日草 0.14.1