Initial commit

This commit is contained in:
Peter Stockings
2023-12-14 22:22:15 +11:00
commit bbe3356a9c
10 changed files with 5954 additions and 0 deletions

34
app.py Normal file
View File

@@ -0,0 +1,34 @@
import os
from flask import Flask, render_template
import jinja_partials
from jinja2_fragments import render_block
from flask_htmx import HTMX
import minify_html
app = Flask(__name__)
app.config.from_pyfile('config.py')
jinja_partials.register_extensions(app)
htmx = HTMX(app)
@app.after_request
def response_minify(response):
"""
minify html response to decrease site traffic
"""
if response.content_type == u'text/html; charset=utf-8':
response.set_data(
minify_html.minify(response.get_data(
as_text=True), minify_js=True, remove_processing_instructions=True)
)
return response
return response
@ app.route("/", methods=["GET"])
def index():
return render_template("index.html")
if __name__ == '__main__':
# Bind to PORT if defined, otherwise default to 5000.
port = int(os.environ.get('PORT', 5000))
app.run(host='127.0.0.1', port=port)