سؤال

I'm trying to get a django application with neo4django to talk to a neo4j database hosted on graphenedb .

I have my local installation working perfectly, but there is no authentication required to connect to my local neo4j instance. To connect to graphenedb, I need to pass my credentials and I can't work out how to do that.

I can see an issue on the neo4django github repo (https://github.com/scholrly/neo4django/issues/224) which suggests this should be possible, but I can't see how.

I've tried adding

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

to the default entry in my NEO4J_DATABASES dictionary, but I get

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

Anyone out there got this working?

EDIT

Here's the rest of my NEO4J_DATABASES (the settings are all parsed elsewhere from a NEO4J_URL environment variable that I created):

NEO4J_DATABASES = {
    'default' : {
        'HOST': neo4j_uri.hostname,
        'PORT': neo4j_uri.port,
        'ENDPOINT': neo4j_uri.path,
        'OPTIONS': {
            'USERNAME': neo4j_uri.username,
            'PASSWORD': neo4j_uri.password
        }
    }
}
هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top