optimierungen

This commit is contained in:
2023-11-02 15:45:09 +01:00
parent 3734fa2277
commit 216266191c
10 changed files with 18 additions and 31 deletions

23
app/Flask-QR.py Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
# notwendige pakete via pip:
# pip install Flask Flask-QRcode
from flask import Flask, render_template, request
from flask_qrcode import QRcode
app = Flask(__name__)
QRcode(app)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/qr.html")
def makeqr():
data = request.args.get('qr')
return render_template('qr.html', data=data)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)

1
app/requirements.txt Normal file
View File

@@ -0,0 +1 @@
Flask-QRcode

23
app/templates/index.html Normal file
View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>QR-Code-Generator</title>
</head>
<body>
<H1 style="text-align: center; background-color: #eee; border-radius: .5em;">QRCode-Generator</H1>
<p style="text-align: center;">
</p>
<form action="qr.html" style="text-align: center">
<label for="qr" style="font-size: 2em;">Was soll im QR-Code stehen?</label><br>
<input type="text" name="qr" id="qr" size="60" maxlength="120">
<br><br>
<button type="reset">Eingaben zur&uuml;cksetzen</button>
<button type="submit">Eingaben absenden</button>
</form>
</body>
</html>

20
app/templates/qr.html Normal file
View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="de">
<head>
<title>QR-Code-Generator</title>
</head>
<body>
<H1 style="text-align: center; background-color: #eee; border-radius: .5em;">QRCode-Generator</H1>
<p style="text-align: center; font-size: 2em;">
<b>folgender Text wurde im QR-Code codiert:</b><br>
{{ data }} <br>
<br>
<!--suppress HtmlUnknownTarget -->
<img src="{{ data|qrcode }}" alt="QR-Code f&uuml;r {{ data }}">
</p>
<p style="text-align: center; font-size: 1.5em;">
<a href="./">Noch einmal bitte!</a>
</p>
</body>
</html>