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

1
.buildpacks Normal file
View File

@@ -0,0 +1 @@
https://github.com/heroku/heroku-buildpack-python#v210

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: gunicorn app:app --workers=4

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)

4
config.py Normal file
View File

@@ -0,0 +1,4 @@
TESTING = True
DEBUG = True
FLASK_ENV = 'development'
SECRET_KEY = ''

12
requirements.txt Normal file
View File

@@ -0,0 +1,12 @@
Flask==2.2.2
gunicorn==19.7.1
Jinja2==3.1.0
jinja-partials==0.1.1
psycopg2-binary==2.9.3
flask-htmx==0.2.0
python-dateutil==2.8.2
minify-html==0.10.3
jinja2-fragments==0.3.0
Werkzeug==2.2.2
numpy==1.19.5
pandas==1.3.1

1
runtime.txt Normal file
View File

@@ -0,0 +1 @@
python-3.9.18

1
static/js/htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

5817
static/js/hyperscript.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

20
templates/Index.html Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Function</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900&display=swap" rel="stylesheet" />
<script src="/static/js/tailwindcss@3.2.4.js"></script>
<script src="/static/js/htmx.min.js" defer></script>
<script src="/static/js/hyperscript.min.js" defer></script>
</head>
<body>
<h1>Function</h1>
<h5>Hello world...</h5>
</body>