From 6a21feef0c22fd8e18dbe2450c5f7b49ccd32d5b Mon Sep 17 00:00:00 2001 From: phamduchongan93 Date: Fri, 10 May 2024 06:52:07 -0700 Subject: [PATCH] first commit --- Dockerfile | 27 +++++++++++++ app.py | 20 ++++++++++ qr_code.png | Bin 0 -> 680 bytes static/qr_code.png | Bin 0 -> 431 bytes templates/index.html | 93 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 Dockerfile create mode 100755 app.py create mode 100644 qr_code.png create mode 100644 static/qr_code.png create mode 100644 templates/index.html 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 0000000000000000000000000000000000000000..d38684e5263a8d409b2e162fb6e050bfd2313d2c GIT binary patch literal 680 zcmV;Z0$2TsP)~toVcH;4uv$YrZGwo zRlNW4vv}@#IB^HDn%M=IUNZLcZ9wBPP@kFE=UC;$3B>T{gY-5a$QWRxas33VoH&!X z@;QWT#2JY1!wtpeIp^WTKM+CE3``e*#cZ$ZNRqCJM_A>=iNs=NW&;p^na0?v_2~j; zW@fLSV3iYR5Va^jjtprI=e-agV|%95=#oU5gUWZX*LCjm4u}u2eQTrE3ciMV z-=B9%1Oe+oaW%UHnY|npxrbZj#0kW4o!5v?)nCR|x06~K@9Vq=;&33M#__oZ_&wB@ zy_)CqUWh}o-s`n0$CO6PzBPBB_d#syyza}&Vjtmf1?&~P`~1rjSDmww-REIb-titw zcf@3Ml-nf9UQ29WZ9fh9V5^)sg=lA^;ta43BmvWF$YS}Cp%rpQe4JHIoJnlw;no4- zJFr|3fI+~(0ESE&A7_;lk0n~k-dZj}8d?3UbH~JF--{wwn&{I@>#DjA*9&ntC({J> zP}?hYu}gb*-Rt%qh`;?_tsZ@@5}fOBJrU;rGvS02PB`I&6HYks<%r+kJAN$D&l#`) O0000(j2C2*B1{}p)xi^T9!VS!_QljYsI|_tKEU1%`@h;{`cKEXY$A-c)ZTxtO z0d{tFc6N4l^&KQh>ZivZjevG29jzp3*!p|Co6BE25cEv|_kmh_e!Fuc$qqp58X+VA zk>qyfw^tX=hgHV4`^}9+>{b}pZtfaM37CZb%YR&u4RZ3mQkH#YE%I@+hvTJnRxlRBOd04u&=C?aH65&h& zt%TU+O=~;z+lia@D`|FA5>g{vYcA)Hs;=bogpxlJkdIH2<5Ar$>Z@yJPfb}f&gW~m z$lOZ*$cOIL<+-O + + + + +Virtual Business Card + + + + +
+

John Doe

+

CEO & Founder

+

Acme Corporation

+

Email: john.doe@example.com

+

Phone: +1234567890

+
+ QR Code +
+ +
+ + + +