2

我试图让一个带有 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
        }
    }
}
4

1 回答 1

1

Could you try using

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

(with lower-case keys) instead? I believe that's what worked in the referenced Github issue.

于 2014-02-16T20:18:22.453 回答