Add and use Flask-Minify.

This commit is contained in:
Sage Vaillancourt 2022-09-28 01:55:10 +00:00
parent 1b32206a23
commit 777575619c
2 changed files with 4 additions and 1 deletions

View File

@ -2,8 +2,9 @@ bcrypt==4.0.0
click==8.1.3 click==8.1.3
email-validator==1.3.0 email-validator==1.3.0
Flask==2.2.2 Flask==2.2.2
Flask-WTF==1.0.1 Flask-Minify=0.39
Flask-SQLAlchemy==2.5.1 Flask-SQLAlchemy==2.5.1
Flask-WTF==1.0.1
gunicorn==20.1.0 gunicorn==20.1.0
itsdangerous==2.1.2 itsdangerous==2.1.2
Jinja2==3.1.2 Jinja2==3.1.2

View File

@ -4,6 +4,7 @@ import os
import sys import sys
from flask import Flask from flask import Flask
from flask_minify import Minify
import undercover.routes import undercover.routes
from undercover.css import optimize_css_file from undercover.css import optimize_css_file
@ -13,6 +14,7 @@ def create_app(test_config=None):
optimize_css_file() optimize_css_file()
app = Flask(__name__, instance_relative_config=True) app = Flask(__name__, instance_relative_config=True)
Minify(app=app, html=True, js=True, cssless=True)
secret_key = os.environ.get('UNDERCOVER_SECRET_KEY') secret_key = os.environ.get('UNDERCOVER_SECRET_KEY')
if not secret_key: if not secret_key:
sys.stderr.write("WARNING: UNDERCOVER_SECRET_KEY is not defined! Application may be insecure.\n") sys.stderr.write("WARNING: UNDERCOVER_SECRET_KEY is not defined! Application may be insecure.\n")