def test_loading_profile_from_file(): filename = path.join(path.dirname(__file__), "..", "..", "resources", "example.ini") prof = ConnectionProfile.from_file(filename, "Neo4j") data = dict(prof) assert data == { 'secure': False, 'verify': True, 'scheme': 'bolt', 'user': '******', 'password': '******', 'address': IPv4Address(('graph.mystery.inc', 7777)), 'auth': ('shaggy', 'velma'), 'host': 'graph.mystery.inc', 'port': 7777, 'port_number': 7777, 'protocol': 'bolt', 'uri': 'bolt://[email protected]:7777', }
from py2neo.client.config import ConnectionProfile from py2neo.ogm import Repository from .models import Movie, Person HOME = dirname(__file__) STATIC = path.join(HOME, "static") VIEWS = path.join(HOME, "views") CONFIG = path.join(HOME, "movies.ini") # Update the template search path used by Bottle TEMPLATE_PATH.append(VIEWS) # Load the connection details from the config file profile = ConnectionProfile.from_file(CONFIG, "Neo4j") # Set up a link to the local graph database. repo = Repository(profile) @get("/static/<filename>") def get_static(filename): """ Static file accessor. """ return static_file(filename, root=STATIC) @get("/") def get_index(): """ Index page.