mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-06-24 22:30:25 -04:00
Add support to override default templates with custom ones (Fixes: #14)
This commit is contained in:
parent
15a1139577
commit
c52b417840
3 changed files with 14 additions and 0 deletions
7
main.py
7
main.py
|
@ -6,6 +6,7 @@ from libmat2 import parser_factory
|
|||
|
||||
from flask import Flask, flash, request, redirect, url_for, render_template
|
||||
from flask import send_from_directory, after_this_request
|
||||
import jinja2
|
||||
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
|
@ -14,6 +15,12 @@ app = Flask(__name__)
|
|||
app.config['SECRET_KEY'] = os.urandom(32)
|
||||
app.config['UPLOAD_FOLDER'] = './uploads/'
|
||||
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB
|
||||
app.config['CUSTOM_TEMPLATES_DIR'] = 'custom_templates'
|
||||
|
||||
app.jinja_loader = jinja2.ChoiceLoader([ # type: ignore
|
||||
jinja2.FileSystemLoader(app.config['CUSTOM_TEMPLATES_DIR']),
|
||||
app.jinja_loader,
|
||||
])
|
||||
|
||||
def __hash_file(filepath: str) -> str:
|
||||
sha256 = hashlib.sha256()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue