diff --git a/flaskr/content.py b/flaskr/content.py index 38f67a8..1f60d25 100644 --- a/flaskr/content.py +++ b/flaskr/content.py @@ -1,7 +1,17 @@ from collections import namedtuple from yaml import safe_load as yaml_safe_load +from os.path import abspath, dirname, join + + +PROJECT_DIRECTORY = abspath(dirname(dirname(__file__))) + + +def get_path(relative_path): + """ + Absolutize a relative path to this project's root directory. + """ + return abspath(join(PROJECT_DIRECTORY, relative_path)) -from core import get_path with open(get_path('content.yml'), 'r') as content_file: content_dict = yaml_safe_load(content_file.read()) -- libgit2 0.21.2