comment-server/src/settings.py

18 lines
393 B
Python
Raw Permalink Normal View History

2019-05-26 00:42:39 -04:00
# cython: language_level=3
2019-05-20 05:08:04 -04:00
import json
2019-05-21 07:54:52 -04:00
import pathlib
2019-05-21 06:56:27 -04:00
2019-05-20 05:08:04 -04:00
root_dir = pathlib.Path(__file__).parent.parent
config_path = root_dir / 'config' / 'conf.json'
def get_config(filepath):
with open(filepath, 'r') as cfile:
conf = json.load(cfile)
2019-05-20 19:09:07 -04:00
for key, path in conf['PATH'].items():
conf['PATH'][key] = str(root_dir / path)
2019-05-20 05:08:04 -04:00
return conf
config = get_config(config_path)