I'm running an app on Heroku using GrapheneDB, Tornado, py2neo.
I'm trying to use py2neo's Cypher transactions.
I can run this locally:
graphenedb_url = os.environ.get("GRAPHENEDB_URL", "http://localhost:7474/")
service_root = neo4j.ServiceRoot(URI(graphenedb_url).resolve("/"))
graph_db = service_root.graph_db
session = cypher.Session()
but when I deploy to Heroku, I get:
2014-10-06T20:33:34.626356+00:00 app[web.1]: File "main.py", line 33, in <module>
2014-10-06T20:33:34.626364+00:00 app[web.1]: session = cypher.Session()
2014-10-06T20:33:34.626367+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/cypher.py", line 127, in __init__
2014-10-06T20:33:34.626435+00:00 app[web.1]: self._graph_db = self._service_root.graph_db
2014-10-06T20:33:34.626456+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/neo4j.py", line 462, in graph_db
2014-10-06T20:33:34.626550+00:00 app[web.1]: return GraphDatabaseService.get_instance(self.__metadata__["data"])
2014-10-06T20:33:34.626571+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/neo4j.py", line 338, in __metadata__
2014-10-06T20:33:34.626641+00:00 app[web.1]: self.refresh()
2014-10-06T20:33:34.626662+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/neo4j.py", line 360, in refresh
2014-10-06T20:33:34.626732+00:00 app[web.1]: self._metadata = ResourceMetadata(self._get().content)
2014-10-06T20:33:34.626756+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/neo4j.py", line 365, in _get
2014-10-06T20:33:34.626838+00:00 app[web.1]: product=self._product)
2014-10-06T20:33:34.626842+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/packages/httpstream/http.py", line 803, in get
2014-10-06T20:33:34.627276+00:00 app[web.1]: return rq.submit(redirect_limit=redirect_limit, **kwargs)
2014-10-06T20:33:34.627279+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/packages/httpstream/http.py", line 388, in submit
2014-10-06T20:33:34.627281+00:00 app[web.1]: http, rs = submit(self.method, uri, self.body, headers)
2014-10-06T20:33:34.627282+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/py2neo/packages/httpstream/http.py", line 328, in submit
2014-10-06T20:33:34.627288+00:00 app[web.1]: raise SocketError(code, description, host_port=uri.host_port)
2014-10-06T20:33:34.627290+00:00 app[web.1]: py2neo.packages.httpstream.http.SocketError: Connection refused
2014-10-06T20:33:34.626336+00:00 app[web.1]: Traceback (most recent call last):
2014-10-06T20:33:35.495790+00:00 heroku[web.1]: Process exited with status 1
2014-10-06T20:33:35.505975+00:00 heroku[web.1]: State changed from starting to crashed
I also tried:
session = cypher.Session(URI(graphenedb_url).resolve("/"))
But that doesn't even work locally. I've tried looking through the Graphene Docs, but no luck.
Any advice?
UPDATE: If I do:
session = cypher.Session(os.environ.get("GRAPHENEDB_URL"))
tx = session.create_transaction()
tx.append("MATCH n RETURN n")
results = tx.execute()
for r in results[0]:
r.values[0]
I get:
Node('http://localhost:0/db/data/node/40')
Node('http://localhost:0/db/data/node/41')
Node('http://localhost:0/db/data/node/42')
I'm guessing that port should be 7474 instead of 0?
Or shouldn't that be Node('GRAPHENEDB_URI/db/data/node/40')
instead of localhost?