diff --git a/hello.py b/hello.py index 2420ed6..f40d413 100644 --- a/hello.py +++ b/hello.py @@ -3,11 +3,19 @@ """ from flask import Flask +from flask import render_template +from flask import request + app = Flask(__name__) @app.route('/') def hello_world(): - return 'Hello World!' + return render_template('index.html') + +@app.route('/login/', methods=['GET','POST']) +def login(name=None, age=None, patrick=None): + return render_template('login.html', name=request.form['name'], age=request.form['age'], patrick=request.form['patrick']) if __name__ == '__main__': + #app.debug = True app.run() diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..329d40f --- /dev/null +++ b/templates/index.html @@ -0,0 +1,17 @@ + + + + + Hello World + + + +

Hello! Please input your name, age, and favorite SoftDes Ninja.

+
+ Name:
+ Age:
+ Favorite SoftDes Ninja:
+ +
+ + diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..552e76f --- /dev/null +++ b/templates/login.html @@ -0,0 +1,11 @@ + +{% if name and age %} +

Profile

+

{{ name }}

+Age: {{ age }}
+Favorite SoftDes Ninja: Patrick Huston +{% else %} +You forgot some information
+Click hereto go back +{% endif %} +