projects
/
wiki
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a config file
[wiki]
/
app.py
diff --git
a/app.py
b/app.py
index
b87aa3a
..
3c899a8
100644
(file)
--- a/
app.py
+++ b/
app.py
@@
-1,6
+1,13
@@
+import json
+import pathlib
+
import commonmark
import flask
import commonmark
import flask
+with open(pathlib.Path(__file__).parent / 'config.json') as f:
+ CONFIGURATION = json.loads(f.read())
+ print(CONFIGURATION)
+
app = flask.Flask(__name__)
@app.route('/')
app = flask.Flask(__name__)
@app.route('/')
@@
-10,7
+17,7
@@
def index():
@app.route('/p/<name>')
def page(name):
for ch in name:
@app.route('/p/<name>')
def page(name):
for ch in name:
- if not ch in 'abcdefghijklmnopqrstuvwxyz
_
0123456789':
+ if not ch in 'abcdefghijklmnopqrstuvwxyz
-
0123456789':
flask.abort(404)
try:
flask.abort(404)
try:
@@
-19,7
+26,7
@@
def page(name):
except FileNotFoundError as e:
flask.abort(404)
except FileNotFoundError as e:
flask.abort(404)
- title = name.replace('
_
', ' ').title()
+ title = name.replace('
-
', ' ').title()
return flask.render_template('page.html', content=content, title=title)
return flask.render_template('page.html', content=content, title=title)