Use the configured pages from config.json
authorDavid Kerkeslager <kerkeslager@gmail.com>
Sat, 14 May 2022 03:42:12 +0000 (23:42 -0400)
committerDavid Kerkeslager <kerkeslager@gmail.com>
Sat, 14 May 2022 03:42:12 +0000 (23:42 -0400)
app.py

diff --git a/app.py b/app.py
index 3c899a8..8e1464a 100644 (file)
--- 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())
 
 with open(pathlib.Path(__file__).parent / 'config.json') as f:
     CONFIGURATION = json.loads(f.read())
-    print(CONFIGURATION)
 
 app = flask.Flask(__name__)
 
 
 app = flask.Flask(__name__)
 
@@ -21,7 +20,7 @@ def page(name):
             flask.abort(404)
 
     try:
             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)
             content = commonmark.commonmark(f.read())
     except FileNotFoundError as e:
         flask.abort(404)