From 2e84b12461567c4fa26cbf14189da3f70011d7af Mon Sep 17 00:00:00 2001 From: phamduchongan93 Date: Fri, 10 May 2024 07:39:30 -0700 Subject: [PATCH] edit dockerfile and app.py --- Dockerfile | 2 +- app.py | 6 ++++-- requirements.txt | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index 5831998..2f66861 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,4 +24,4 @@ VOLUME /app/static EXPOSE 5000 # Command to run the application -CMD ["python", "app.py"] +CMD python3 app.py diff --git a/app.py b/app.py index c76e64a..4b55ab5 100755 --- a/app.py +++ b/app.py @@ -2,6 +2,8 @@ from flask import Flask, render_template import qrcode import os +from urllib.parse import quote +from PIL import Image app = Flask(__name__, template_folder="templates") @app.route('/') @@ -12,9 +14,9 @@ def index(): qr.make(fit=True) qr_img = qr.make_image(fill_color="black", back_color="white") qr_img = qr.make_image(fill_color="black", back_color="white") - qr_img.save("/home/anpham/Projects/virtual-bussiness-card/static/qr_code.png") # Save QR code image + qr_img.save("static/qr_code.png") # Save QR code image return render_template('index.html') if __name__ == '__main__': - app.run(debug=True) + app.run(host='0.0.0.0', port=5000) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1aef5c7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +Flask==2.0.1 +qrcode==7.3 +Pillow==8.3.1 +Werkzeug==2.0.1