我想知道如何让neo4j与一起工作。有人做过这个吗?你遇到了什么问题?
发布于 2014-11-05 08:39:56
这就是你要的,
基本设置
gcloudgcloud compute ssh INSTANCE_NAME --zone AVAILABLE_ZONES -> 区带neo4j --您可能需要安装java(修复)和lsof (Fix:apt-get install lsof)。GCE配置
gcloud compute firewall-rules create neo4j --network default --allow tcp:7474四处游玩
./bin/neo4j starthttp://IP_ADDRESS:7474/一旦安装了py2neo并启动了服务器,尝试一些pycode来测试它。
>> from py2neo.neo4j import GraphDatabaseService, CypherQuery
>> # Set up a link to the local graph database.
>> # When () left blank defaults to http://localhost:7474/db/data/
>> graph = GraphDatabaseService('http://IP_ADDRESS:7474/db/data/')
>> CypherQuery(graph, "CREATE (n {name:'Example'}) RETURN n;").execute()在上面的python设置/代码中,也可以在GAE中使用它。
参考文献
编辑: Appengine + Neo4j
from py2neo import neo4j
GRAPH_DB = neo4j.GraphDatabaseService(
'http://uname:psswd@localhost:7474/db/data/')
if IS_PROD:
GRAPH_DB = neo4j.GraphDatabaseService(
'http://uname:psswd@host:port/db/data/')
def _execute(query):
"""Execute all neo4j queries and return list of Record objects.
Returns:
Returns list of Record objects.
"""
try:
result = neo4j.CypherQuery(GRAPH_DB, query).execute()
# logging.info(result.data)
return result
except neo4j.CypherError as error:
logging.error(error.exception)
except DeadlineExceededError as dead:
logging.warn(dead)
except urlfetch_errors.InternalTransientError as tra_error:
logging.warn(tra_error)
except httplib.HTTPException as exp:
logging.warn(exp)
except neo4j.http.SocketError as soc:
logging.warn(soc)https://stackoverflow.com/questions/26751346
复制相似问题