diff options
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 7 |
1 files changed, 7 insertions, 0 deletions
| @@ -6,6 +6,7 @@ from libmat2 import parser_factory | |||
| 6 | 6 | ||
| 7 | from flask import Flask, flash, request, redirect, url_for, render_template | 7 | from flask import Flask, flash, request, redirect, url_for, render_template |
| 8 | from flask import send_from_directory, after_this_request | 8 | from flask import send_from_directory, after_this_request |
| 9 | import jinja2 | ||
| 9 | 10 | ||
| 10 | from werkzeug.utils import secure_filename | 11 | from werkzeug.utils import secure_filename |
| 11 | 12 | ||
| @@ -14,6 +15,12 @@ app = Flask(__name__) | |||
| 14 | app.config['SECRET_KEY'] = os.urandom(32) | 15 | app.config['SECRET_KEY'] = os.urandom(32) |
| 15 | app.config['UPLOAD_FOLDER'] = './uploads/' | 16 | app.config['UPLOAD_FOLDER'] = './uploads/' |
| 16 | app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB | 17 | app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB |
| 18 | app.config['CUSTOM_TEMPLATES_DIR'] = 'custom_templates' | ||
| 19 | |||
| 20 | app.jinja_loader = jinja2.ChoiceLoader([ # type: ignore | ||
| 21 | jinja2.FileSystemLoader(app.config['CUSTOM_TEMPLATES_DIR']), | ||
| 22 | app.jinja_loader, | ||
| 23 | ]) | ||
| 17 | 24 | ||
| 18 | def __hash_file(filepath: str) -> str: | 25 | def __hash_file(filepath: str) -> str: |
| 19 | sha256 = hashlib.sha256() | 26 | sha256 = hashlib.sha256() |
