【问题标题】:Error when connecting to neo4j via neo4django通过 neo4django 连接到 neo4j 时出错
【发布时间】:2013-03-19 16:56:51
【问题描述】:

我有一个 Django(1.4.0 版)网络应用程序,它使用 neo4django 映射器在 neo4j(1.8.2 版)上运行查询。

但是,只要我进行类似

的查询
OnlinePerson.objects.filter(name="Bijan")

我得到一个运行时错误

('The type node for class OnlinePerson could not be created in the database.', StatusException())

我尝试了很多不同的方法,但无法解决!

Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/Users/Bijan/BHIC/mySVN/NeoD/src/NeoD/views.py" in home
  22.     return render_to_response('index.html', {'Person' : entries, 'Person2': ["Bijan","Nastaran"]})
File "/Library/Python/2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/Library/Python/2.7/site-packages/django/template/loader.py" in render_to_string
  171.         return t.render(Context(dictionary))
File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/Library/Python/2.7/site-packages/django/template/base.py" in _render
  134.         return self.nodelist.render(context)
File "/Library/Python/2.7/site-packages/django/template/base.py" in render
  823.                 bit = self.render_node(node, context)
File "/Library/Python/2.7/site-packages/django/template/debug.py" in render_node
  74.             return node.render(context)
File "/Library/Python/2.7/site-packages/django/template/defaulttags.py" in render
  145.         len_values = len(values)
File "/Library/Python/2.7/site-packages/django/db/models/query.py" in __len__
  85.                 self._result_cache = list(self.iterator())
File "/Library/Python/2.7/site-packages/neo4django/db/models/query.py" in iterator
  733.         for model in self.query.execute(using):
File "/Library/Python/2.7/site-packages/neo4django/db/models/query.py" in execute
  610.             type_node = self.nodetype._type_node(using)
File "/Library/Python/2.7/site-packages/neo4django/db/models/base.py" in _type_node
  423.             return cls.__type_node_classmethod(using)
File "/Library/Python/2.7/site-packages/neo4django/db/models/base.py" in __type_node
  406.             raise RuntimeError(error_message, e)

Exception Type: RuntimeError at /
Exception Value: ('The type node for class OnlinePerson could not be created in the database.', StatusException())

【问题讨论】:

  • 能否用 neo4django 和 Neo4j 的版本更新问题?

标签: django neo4j neo4django


【解决方案1】:

经过多次努力和尝试不同的解决方案,问题终于解决了。我认为主要问题在于我的 neo4j 版本(1.8.2)。

切换回 1.7.2 后,一切正常。

【讨论】:

  • PyPi (0.1.7) 上的 neo4django 版本最高支持 1.7.2- GitHub 上的 neo4django 支持 1.8.2-1.9M05。如果您想要最新版本,您可以随时pip install -e git+https://github.com/scholrly/neo4django#egg=neo4django-dev。祝你好运!
【解决方案2】:

您是否安装了 Neo4j Gremlin 插件?类型节点是使用 Gremlin 插件创建的,因为它们需要某些事务性承诺。它通常默认安装。不幸的是,某些环境(如 Heroku)禁用了此插件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-10
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多