From ab830c250e7bd2b14d3197bab824919e9bd062a7 Mon Sep 17 00:00:00 2001 From: gashapwn Date: Sun, 22 Nov 2020 00:41:37 +0000 Subject: [PATCH] added app.py to test site --- app.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app.py diff --git a/app.py b/app.py new file mode 100644 index 0000000..3b78250 --- /dev/null +++ b/app.py @@ -0,0 +1,29 @@ +from flask import Flask, redirect, url_for, render_template, request + +app=Flask(__name__) + +@app.route("/") +def home(): + app.route('/') + return render_template("home.html") + +def home2(name): + # app.route('/home2/') + # return redirect(url_for('home')) + return render_template("home.html") + +def success(name): + return "welcome %s" % name + +def login(): + if request.method == "POST": + user = request.form["nm"] + return redirect(url_for('success', name = user)) + else: + return redirect(url_for('home')) + +if __name__=="__main__": + app.add_url_rule('/home2/', 'home2', home2) + app.add_url_rule('/success/', 'success', success) + app.add_url_rule('/login', 'login', login, methods = ['POST', 'GET']) + app.run(host="192.168.1.228",debug=True)