0

使用 django-tastypie-mongoengine

相同的配置在本地服务器/ Windows 服务器上运行良好。在linux服务器上,出现以下错误:

{"error_message": "'QuerySet' object has no attribute '_reset_already_indexed'", "traceback": "Traceback (most recent call last):\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 217, in wrapper\n response = callback(request, *args, **kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 459, in dispatch_list\n return self.dispatch('list', request, **kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 373, in dispatch\n return super(MongoEngineResource, self).dispatch(request_type, request, **kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 491, in dispatch\n response = method(request, **kwargs)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 1299, in get_list\n objects = self.obj_get_list(bundle=base_bundle, **self.remove_api_resource_names(kwargs))\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2112, in obj_get_list\n objects = self.apply_filters(bundle.request, applicable_filters)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie/resources.py\", line 2084, in apply_filters\n return self.get_object_list(request).filter(**applicable_filters)\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 309, in get_object_list\n self._reset_collection()\n\n File \"/usr/local/lib/python2.7/site-packages/tastypie_mongoengine/resources.py\", line 301, in _reset_collection\n self._meta.queryset._reset_already_indexed()\n\nAttributeError: 'QuerySet' object has no attribute '_reset_already_indexed'\n"}

请帮忙!!

4

2 回答 2

1

您需要卸载 mongoengine 0.8.0RCX 并安装 mongoengine 0.7.10

于 2013-05-16T09:32:39.613 回答
1

在将 Mongoengine 从 0.7.9 升级到 0.8.4 之后,这也发生在我身上。事实证明,他们使用 django-tastypie-mongoengine 的 v0.4.2 版本解决了这个问题。

在您的 virtualenv 中(如果您使用一个):

$ pip install django-tastypie-mongoengine==0.4.2

或者如果您想要最新版本:

$ pip install django-tastypie-mongoengine -U

你是金子:-)

在此处构建信息:为 django-tastypie-mongoengine 构建

HEAD 现在位于 703fa87,因为_reset_already_indexed不再需要更新版本的 MongoEngine。

于 2013-09-21T09:37:51.170 回答