From a2167c05d5b21c865965c53e538c8f60d8167b28 Mon Sep 17 00:00:00 2001 From: "willem.thorbecke@students.olin.edu" Date: Mon, 28 Mar 2016 01:21:19 -0400 Subject: [PATCH] done --- hello.py | 11 ++++++++++- templates/answers.html | 6 ++++++ templates/answers.html~ | 6 ++++++ templates/index.html | 20 ++++++++++++++++++++ templates/index.html~ | 20 ++++++++++++++++++++ templates/login.html | 7 +++++++ templates/login.html~ | 7 +++++++ 7 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 templates/answers.html create mode 100644 templates/answers.html~ create mode 100644 templates/index.html create mode 100644 templates/index.html~ create mode 100644 templates/login.html create mode 100644 templates/login.html~ diff --git a/hello.py b/hello.py index 2420ed6..134b9bf 100644 --- a/hello.py +++ b/hello.py @@ -3,11 +3,20 @@ """ 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('/answers/', methods=['GET','POST']) +def answers(name=None, age=None, fav=None): + return render_template('answers.html', name=request.form['name'], age=request.form['age'], fav=request.form['fav']) + if __name__ == '__main__': + app.debug = True app.run() diff --git a/templates/answers.html b/templates/answers.html new file mode 100644 index 0000000..787bd0d --- /dev/null +++ b/templates/answers.html @@ -0,0 +1,6 @@ + +{% if name and age and fav %} +

Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston

+{% else %} +

You forgot something! Click here

+{% endif %} diff --git a/templates/answers.html~ b/templates/answers.html~ new file mode 100644 index 0000000..787bd0d --- /dev/null +++ b/templates/answers.html~ @@ -0,0 +1,6 @@ + +{% if name and age and fav %} +

Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston

+{% else %} +

You forgot something! Click here

+{% endif %} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..c467483 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,20 @@ + + + + + A Small Hello + + + + +

Hi

+

Input your name, age, and favorite softdes ninja please.

+
+ Name: + Age: + Favorite SoftDes Ninja: + +
+ + + diff --git a/templates/index.html~ b/templates/index.html~ new file mode 100644 index 0000000..c467483 --- /dev/null +++ b/templates/index.html~ @@ -0,0 +1,20 @@ + + + + + A Small Hello + + + + +

Hi

+

Input your name, age, and favorite softdes ninja please.

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

Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston

+{% else %} +

You forgot something! Click here

+{% endif %} diff --git a/templates/login.html~ b/templates/login.html~ new file mode 100644 index 0000000..1d686a0 --- /dev/null +++ b/templates/login.html~ @@ -0,0 +1,7 @@ + +Hello from Flask +{% if name and age and fav %} +

Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston

+{% else %} +

You forgot something! Click here

+{% endif %}