I'm using py2neo without a flask extension (since it behaves quite strangely) in my flask project.
What I'm trying to do, is to preserve my database connection in the application context (since it is preserved during the entire request handling, right?).
Based on flask's documentation, I have the following code:
def get_neo4j():
with app.app_context():
neo4j = getattr(g, '_neo4j', None)
if neo4j is None:
connection_string = http blah blah blah
neo4j = g._neo4j = Graph(connection_string)
return neo4j
Is this correct? How can I edit the above code to benefit from werkzeug's local proxy?