From 9d6816f21029dfc943cc29af330d31ea4a844a22 Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Wed, 23 Oct 2024 14:56:39 +0200 Subject: [PATCH] making page stay on the same page when pressing button --- src/Python/flask/web/app.py | 4 ++-- src/Python/flask/web/templates/index.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index 057a902..fef83d8 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -1,4 +1,4 @@ -from flask import Flask, request, render_template +from flask import Flask, request, render_template, redirect import paho.mqtt.client as mqtt app = Flask(__name__) @@ -21,7 +21,7 @@ def move(): print("Bericht succesvol gepubliceerd") else: print("Fout bij het publiceren van bericht") - return "Bericht verzonden!" + return redirect('/') if __name__ == '__main__': app.run(debug=True) diff --git a/src/Python/flask/web/templates/index.html b/src/Python/flask/web/templates/index.html index 0ab2680..434dfa1 100644 --- a/src/Python/flask/web/templates/index.html +++ b/src/Python/flask/web/templates/index.html @@ -5,10 +5,10 @@
- - - - + + + +