Commit 2d25a68c0cee62ee665f75d0de85ed8cc74d1316
1 parent
6b9c0dd2
Exists in
master
Fix path relativity.
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
flaskr/content.py
1 | 1 | from collections import namedtuple |
2 | 2 | from yaml import safe_load as yaml_safe_load |
3 | +from os.path import abspath, dirname, join | |
4 | + | |
5 | + | |
6 | +PROJECT_DIRECTORY = abspath(dirname(dirname(__file__))) | |
7 | + | |
8 | + | |
9 | +def get_path(relative_path): | |
10 | + """ | |
11 | + Absolutize a relative path to this project's root directory. | |
12 | + """ | |
13 | + return abspath(join(PROJECT_DIRECTORY, relative_path)) | |
3 | 14 | |
4 | -from core import get_path | |
5 | 15 | |
6 | 16 | with open(get_path('content.yml'), 'r') as content_file: |
7 | 17 | content_dict = yaml_safe_load(content_file.read()) | ... | ... |