#!/bin/python3 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('/') 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("static/qr_code.png") # Save QR code image return render_template('index.html') if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)