|
@@ -19,29 +19,17 @@ def index():
|
|
|
return send_from_directory('static', 'index.html')
|
|
|
|
|
|
|
|
|
-@app.route("/tutorial")
|
|
|
-@app.route("/tutorial/book")
|
|
|
-def tutorial_book():
|
|
|
- """Display book"""
|
|
|
- return send_from_directory('static', 'tutorial/book.pdf')
|
|
|
+@app.route("/tutorial", defaults={"document": "book"})
|
|
|
+@app.route("/tutorial/<document>.pdf")
|
|
|
+def tutorial_document(document):
|
|
|
+ """Display tutorial document"""
|
|
|
+ return send_from_directory('static', 'tutorial/%s.pdf' % document)
|
|
|
|
|
|
|
|
|
-@app.route("/tutorial/article")
|
|
|
-def tutorial_article():
|
|
|
- """Display book"""
|
|
|
- return send_from_directory('static', 'tutorial/article.pdf')
|
|
|
-
|
|
|
-
|
|
|
-@app.route("/tutorial/dist")
|
|
|
-def tutorial_dist():
|
|
|
- """Display book"""
|
|
|
- return send_from_directory('static', 'tutorial/dist.pdf')
|
|
|
-
|
|
|
-
|
|
|
-@app.route("/tutorial.png")
|
|
|
-def tutorial_dist_png():
|
|
|
- """Display book"""
|
|
|
- return send_from_directory('static', 'tutorial/dist.png')
|
|
|
+@app.route("/tutorial/<image>.png")
|
|
|
+def tutorial_image(image):
|
|
|
+ """Display tutorial image"""
|
|
|
+ return send_from_directory('static', 'tutorial/%s.png' % image)
|
|
|
|
|
|
|
|
|
@app.route('/typeset', methods=['GET', 'POST'])
|
|
@@ -64,3 +52,9 @@ def deploy():
|
|
|
subprocess.check_output(['pipenv', 'sync'])
|
|
|
subprocess.check_output(['touch', 'flask.wsgi'])
|
|
|
return jsonify(True)
|
|
|
+
|
|
|
+
|
|
|
+@app.errorhandler(404)
|
|
|
+def page_not_found(e):
|
|
|
+ """Return 404 page"""
|
|
|
+ return send_from_directory('static', '404.html'), 404
|