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