【问题标题】:Using neo4django with graphenedb将 neo4django 与 graphenedb 一起使用
【发布时间】:2014-02-16 14:57:25
【问题描述】:

我正在尝试使用 neo4django 让 django 应用程序与托管在 graphenedb 上的 neo4j 数据库通信。

我的本​​地安装运行良好,但连接到我的本地 neo4j 实例不需要身份验证。要连接到 graphenedb,我需要传递我的凭据,但我不知道该怎么做。

我可以在 neo4django github repo (https://github.com/scholrly/neo4django/issues/224) 上看到一个问题,这表明这应该是可能的,但我看不出如何。

我已经尝试添加

'OPTIONS': {
        'USERNAME': 'my username',
        'PASSWORD': 'my password'
    }

到我的 NEO4J_DATABASES 字典中的默认条目,但我得到了

File "......./neo4django/neo4django/neo4jclient.py", line 30, in __init__
super(EnhancedGraphDatabase, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'PASSWORD'

有人搞定这个吗?

编辑

这是我的 NEO4J_DATABASES 的其余部分(这些设置都是从​​我创建的 NEO4J_URL 环境变量的其他地方解析的):

NEO4J_DATABASES = {
    'default' : {
        'HOST': neo4j_uri.hostname,
        'PORT': neo4j_uri.port,
        'ENDPOINT': neo4j_uri.path,
        'OPTIONS': {
            'USERNAME': neo4j_uri.username,
            'PASSWORD': neo4j_uri.password
        }
    }
}

【问题讨论】:

  • 你能分享你的NEO4J_DATABASES dict的其余部分吗?

标签: django neo4j neo4django


【解决方案1】:

你可以试试

'OPTIONS': {
    'username': neo4j_uri.username,
    'password': neo4j_uri.password
}

(使用小写键)代替?我相信这在引用的 Github 问题中起作用。

【讨论】:

  • Django 的方式通常是使用大写字母——如果我没有查看源代码,我自己也不会想到 :) 这两种方式都应该可行,我会添加一个问题.
猜你喜欢
  • 1970-01-01
  • 2014-05-14
  • 1970-01-01
  • 2013-10-07
  • 1970-01-01
  • 1970-01-01
  • 2014-03-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多