commit 6a21feef0c22fd8e18dbe2450c5f7b49ccd32d5b Author: phamduchongan93 Date: Fri May 10 06:52:07 2024 -0700 first commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5831998 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Use the official Python image as base +FROM python:3.9-slim + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set the working directory in the container +WORKDIR /app + +# Copy the requirements file into the container +COPY requirements.txt . + +# Install dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the entire application into the container +COPY . . + +# Create a volume for static files +VOLUME /app/static + +# Expose the port the app runs on +EXPOSE 5000 + +# Command to run the application +CMD ["python", "app.py"] diff --git a/app.py b/app.py new file mode 100755 index 0000000..c76e64a --- /dev/null +++ b/app.py @@ -0,0 +1,20 @@ +#!/bin/python3 +from flask import Flask, render_template +import qrcode +import os +app = Flask(__name__, template_folder="templates") + +@app.route('/') +def index(): + # Generate QR code + qr = qrcode.QRCode(version=1, box_size=10, border=5) + qr.add_data("localhost") # You can replace this URL with any link you want + 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 + return render_template('index.html') + +if __name__ == '__main__': + app.run(debug=True) + diff --git a/qr_code.png b/qr_code.png new file mode 100644 index 0000000..d38684e Binary files /dev/null and b/qr_code.png differ diff --git a/static/qr_code.png b/static/qr_code.png new file mode 100644 index 0000000..945b902 Binary files /dev/null and b/static/qr_code.png differ diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..bbef3a1 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,93 @@ + + + + + +Virtual Business Card + + + + +
+

John Doe

+

CEO & Founder

+

Acme Corporation

+

Email: john.doe@example.com

+

Phone: +1234567890

+
+ QR Code +
+ +
+ + + +