我有一个烧瓶应用程序,它使用 neo4j 处理一些数据。当我使用 python 服务器时,一切都在本地运行良好,但是当我在 nginx+uwsgi 上部署时,我无法再在 py2neo 中执行密码查询。我无法判断错误传达是在 py2neo 级别,还是 nginx 权限或类似的东西。(我在与烧瓶相同的盒子上运行 neo4j,开始。)
奇怪的是,查询否则有效,并且它说的索引不存在(“组织”),当我使用 neo4j 控制台时确实存在。这是错误:
File "/var/www/newproj/newproj/view_helpers.py", line 333, in tile_portfolios
X = cypher.execute(cdb,query)[0]
File "/usr/local/lib/python2.7/dist-packages/py2neo/cypher.py", line 261, in execute
params, row_handler=row_handler, metadata_handler=metadata_handler, error_handler=error_handler
File "/usr/local/lib/python2.7/dist-packages/py2neo/cypher.py", line 118, in execute
stacktrace=err.stacktrace,
CypherError: (u'Index `organization` does not exist', u'MissingIndexException', [u'org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$.checkNodeIndex(IndexQueryBuilder.scala:120)', u'org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder$.getNodeGetter(IndexQueryBuilder.scala:87)', u'org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder.createStartPipe(IndexQueryBuilder.scala:62)', u'org.neo4j.cypher.internal.executionplan.builders.IndexQueryBuilder.apply(IndexQueryBuilder.scala:38)', u'org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.prepareExecutionPlan(ExecutionPlanImpl.scala:45)', u'org.neo4j.cypher.internal.executionplan.ExecutionPlanImpl.<init>(ExecutionPlanImpl.scala:31)', u'org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:67)', u'org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:67)', u'org.neo4j.cypher.internal.LRUCache$LazyValue.value(LRUCache.scala:27)', u'org.neo4j.cypher.internal.LRUCache.getOrElseUpdate(LRUCache.scala:39)', u'org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:67)', u'org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:59)', u'org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:63)', u'org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:79)', u'org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:64)', u'java.lang.reflect.Method.invoke(Method.java:616)'])
这就是我确定它说不存在的索引确实存在的原因:
neo4j-sh (?)$ index --indexes
Node indexes:
vertex
organization
Relationship indexes:
edge
neo4j-sh (?)$ index --get-config organization
{
"provider": "lucene",
"type": "exact"
}
那么,这是我应该在 cypher.py 文件中检查的内容吗?或者这看起来像一个权限问题,当它不是由 python 服务器运行时,nginx 可能无法读取来自 locahost:7474 的响应?奇怪的是,py2neo 的其他方面确实在服务器上正常工作,例如neo4j.GraphDatabaseService("http://localhost:7474/db/data/").get_or_create_indexed_node()
任何调试帮助(或向这些优秀项目中的任何一个提交错误报告?)非常感谢。