From: David Kerkeslager Date: Sat, 14 May 2022 03:42:12 +0000 (-0400) Subject: Use the configured pages from config.json X-Git-Url: https://code.kerkeslager.com/?p=wiki;a=commitdiff_plain;h=38c78c0b787bc5fe29f6b024d2d88bdabe3c3476 Use the configured pages from config.json --- diff --git a/app.py b/app.py index 3c899a8..8e1464a 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,6 @@ import flask with open(pathlib.Path(__file__).parent / 'config.json') as f: CONFIGURATION = json.loads(f.read()) - print(CONFIGURATION) app = flask.Flask(__name__) @@ -21,7 +20,7 @@ def page(name): flask.abort(404) try: - with open('pages/{}.md'.format(name), 'r') as f: + with open(pathlib.Path(CONFIGURATION['directory']) / '{}.md'.format(name), 'r') as f: content = commonmark.commonmark(f.read()) except FileNotFoundError as e: flask.abort(404)