summaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authordoobry2019-02-26 12:40:11 +0100
committerdoobry2019-03-04 14:55:53 +0100
commitc52b4178403b641c4383bafc41be44ae4e669394 (patch)
tree4d6b3bccbe909ebb45e05d4b7bd829e51424d0f8 /main.py
parent15a1139577809b64a9f5e8048e52b643525a79a9 (diff)
Add support to override default templates with custom ones (Fixes: #14)
Diffstat (limited to 'main.py')
-rw-r--r--main.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.py b/main.py
index 59c3791..033d8b6 100644
--- a/main.py
+++ b/main.py
@@ -6,6 +6,7 @@ from libmat2 import parser_factory
6 6
7from flask import Flask, flash, request, redirect, url_for, render_template 7from flask import Flask, flash, request, redirect, url_for, render_template
8from flask import send_from_directory, after_this_request 8from flask import send_from_directory, after_this_request
9import jinja2
9 10
10from werkzeug.utils import secure_filename 11from werkzeug.utils import secure_filename
11 12
@@ -14,6 +15,12 @@ app = Flask(__name__)
14app.config['SECRET_KEY'] = os.urandom(32) 15app.config['SECRET_KEY'] = os.urandom(32)
15app.config['UPLOAD_FOLDER'] = './uploads/' 16app.config['UPLOAD_FOLDER'] = './uploads/'
16app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB 17app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB
18app.config['CUSTOM_TEMPLATES_DIR'] = 'custom_templates'
19
20app.jinja_loader = jinja2.ChoiceLoader([ # type: ignore
21 jinja2.FileSystemLoader(app.config['CUSTOM_TEMPLATES_DIR']),
22 app.jinja_loader,
23 ])
17 24
18def __hash_file(filepath: str) -> str: 25def __hash_file(filepath: str) -> str:
19 sha256 = hashlib.sha256() 26 sha256 = hashlib.sha256()