2

I'm trying to deploy my Django app to Heroku using Neo4j's Addon. I'm using Neo4django. Locally, in my settings.py I have the following

NEO4J_DATABASES = {
        'default' : {
            'HOST':'localhost',
            'PORT':7474,
            'ENDPOINT':'/db/data'
        }
    }

However, when deploying to Heroku, I change the settings to

NEO4J_DATABASES = {
    'default' : {
        'HOST':'<someid>.hosted.neo4j.org',
        'PORT':7281,
        'ENDPOINT':'/db/data/',

    }
}

.. I am unable to connect to the database for authentication problems apparently. The error at the bottom of my stack trace:

StatusException: Error [401]: Unauthorized. No permission -- see authorization schemes.

Authorization Required

.. even when I add the login and password provided by the Heroku Neo4j add-on.

Did anyone run in a similar issue before? Thanks in advance

Matt Luongo
  • 14,371
  • 6
  • 53
  • 64
  • You should preferably read the connectionstring out of the environment, Neo4j has a sample: https://github.com/neo4j-contrib/neo4j-heroku-seeds/blob/master/python/flask-py2neo/app.py – friism Mar 06 '13 at 18:54

3 Answers3

2

The Heroku-hosted Neo4j has the Gremlin plugin disabled, which is going to prevent you from running neo4django, bulbflow, or any other client-side library that requires Gremlin.

The most common solution is to run your own instance of Neo4j on AWS, and then connect to that. Please make it clear to the Neo folks that you'd like Gremlin support on Heroku- I think it was disabled because of the shared nature of the Heroku Neo4j instance, but it absolutely hobbles a number of libraries.

Matt Luongo
  • 14,371
  • 6
  • 53
  • 64
1

You can see the Neo4j config url by using heroku config --app your-app. Just use the NEO4J_URL from the environment variable in your code setup. It already contains the credentials for basic auth.

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • 1
    Well, this apparently solved the problem of authentication, but I see this error: `self._dict[attr] = ExtensionModule(self._extensions[attr], self._auth) KeyError: 'GremlinPlugin'` Apparently there is a problem with Gremlin Plugin? –  Mar 07 '13 at 08:58
1

I've got this working by using graphenedb.com to host my neo4j database.

They will allow you to chose the version of neo4j that you would like hosted. If you pick 1.9.6 (or earlier), then the gremlin plugin works and so will neo4django.

You can either sign up with graphenedb via their website and create your db there or just use their heroku plugin (http://blog.graphenedb.com/blog/2014/02/06/our-new-add-on-helps-heroku-users-build-applications-on-top-of-neo4j/) which will do it all for you. The only advantage I've found of using the web interface is that you'll also get the neo4j webadmin.

meatballs
  • 3,917
  • 1
  • 15
  • 19