diff --git a/flask_app.py b/flask_app.py index b03bdc6..3bb1b48 100644 --- a/flask_app.py +++ b/flask_app.py @@ -1,3 +1,25 @@ """ -Put your Flask app code here. -""" \ No newline at end of file +This is my flask code that makes my website, the "result page", and the "not enough information page" +""" +from flask import Flask +from flask import render_template +from flask import request +app = Flask(__name__) + +@app.route('/', methods = ['POST', 'GET']) +def hello_world(): + return render_template('index.html') + +@app.route('/result', methods = ['POST']) +def result(): + error = None + if request.method == 'POST': + if request.form["Name"] and request.form["Age"] and request.form["Who is your favorite SoftDes Ninja"]: + error = None + return render_template("result.html", Name = request.form["Name"], Age = request.form["Age"]) + else: + error = 'Please Fill In Fields' + return render_template('neip.html') + +if __name__ == '__main__': + app.run() diff --git a/hello.py b/hello.py index 2420ed6..7b4a429 100644 --- a/hello.py +++ b/hello.py @@ -3,11 +3,22 @@ """ from flask import Flask +from flask import render_template app = Flask(__name__) @app.route('/') def hello_world(): - return 'Hello World!' + return render_template('index.html') + # return 'This is my Index Page: hi from sam' + +# @app.route('/hello') +# def hello(): +# return 'Hello World' + +@app.route('/hello/') +@app.route('/hello/') +def hello(name=None): + return render_template('hello.html', name=name) if __name__ == '__main__': app.run() diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..345dc1e --- /dev/null +++ b/templates/index.html @@ -0,0 +1,20 @@ + + + + + Sam's Website + + + +

Hello Visitor!

+

Please input all information when prompted below...

+ +
+

Name

+

Age

+

SoftDes_Ninja

+

+
+ + + diff --git a/templates/neip.html b/templates/neip.html new file mode 100644 index 0000000..3e3a794 --- /dev/null +++ b/templates/neip.html @@ -0,0 +1,15 @@ + + + + Not Enough Info Page + + + +

Whoops, not all information was submitted! Please click the "Go Back" button to return to our home page and try again!

+ +
+

+
+ + + diff --git a/templates/result.html b/templates/result.html new file mode 100644 index 0000000..a845bdb --- /dev/null +++ b/templates/result.html @@ -0,0 +1,14 @@ + + + + + + + + +

{{ Name}}

+

{{ Age }}

+

Patrick Huston

+ + +