Add favicon and Dockerfile

This commit is contained in:
elpatron68
2024-05-26 01:11:20 +02:00
parent 32ecde1b87
commit b1f7f979c2
5 changed files with 34 additions and 3 deletions

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# start by pulling the python image
FROM python:3.8-alpine
# copy the requirements file into the image
COPY ./requirements.txt /app/requirements.txt
# switch working directory
WORKDIR /app
# install the dependencies and packages in the requirements file
RUN pip install -r requirements.txt
# copy every content from the local file to the image
COPY ./app.py /app
COPY ./templates/index.html /app/templates/index.html
COPY ./static/favicon.ico /app/static/favicon.ico
# configure the container to run in an executed manner
ENTRYPOINT [ "python" ]
CMD ["app.py" ]

13
app.py
View File

@@ -1,4 +1,5 @@
from flask import Flask, render_template, request, session import os
from flask import Flask, render_template, request, session, send_from_directory
from flask_bootstrap import Bootstrap from flask_bootstrap import Bootstrap
app = Flask(__name__) app = Flask(__name__)
@@ -7,6 +8,7 @@ Bootstrap(app)
gesamtwert = 0 gesamtwert = 0
change = 0 change = 0
given = 0
sum = "" sum = ""
item1 = 0 item1 = 0
item2 = 0 item2 = 0
@@ -17,7 +19,7 @@ item6 = 0
@app.route("/", methods=["GET", "POST"]) @app.route("/", methods=["GET", "POST"])
def index(): def index():
global gesamtwert, item1, item2, item3, item4, item5, item6, sum, givenfloat, change global gesamtwert, item1, item2, item3, item4, item5, item6, sum, givenfloat, change, given
if request.method == "POST": if request.method == "POST":
# wert = float(request.form["wert"]) # wert = float(request.form["wert"])
@@ -79,5 +81,10 @@ def index():
item6=session.get('item6', 0), item6=session.get('item6', 0),
) )
@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True, host="192.168.177.24") app.run(debug=True, host='0.0.0.0')

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
Flask==3.0.3
Flask-Bootstrap==3.3.7.1
requests==2.32.2

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB