Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 6 additions & 0 deletions templates/answers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
{% if name and age and fav %}
<h1>Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston</h1>
{% else %}
<h1>You forgot something! Click <a href="/"> here </a> </h1>
{% endif %}
6 changes: 6 additions & 0 deletions templates/answers.html~
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
{% if name and age and fav %}
<h1>Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston</h1>
{% else %}
<h1>You forgot something! Click <a href="/"> here </a> </h1>
{% endif %}
20 changes: 20 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>
A Small Hello
</title>
</head>

<body>
<h1>Hi</h1>
<p>Input your name, age, and favorite softdes ninja please.</p>
<form action = "/answers/", method="post">
Name: <Input type="text" name = "name">
Age: <Input type="text" name = "age">
Favorite SoftDes Ninja: <Input type="text" name = "fav">
<Input type = "submit" value = "submit!">
</form>

</body>
</html>
20 changes: 20 additions & 0 deletions templates/index.html~
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>
A Small Hello
</title>
</head>

<body>
<h1>Hi</h1>
<p>Input your name, age, and favorite softdes ninja please.</p>
<form action = "/answers/", method="post">
Name: <Input type="text" name = "name">
Age: <Input type="text" name = "age">
Favorite SoftDes Ninja: <Input type="text" name = "fav">
<Input type = "submit" value = "submit!">
</form>

</body>
</html>
7 changes: 7 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<title>Hello from Flask</title>
{% if name and age and fav %}
<h1>Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston</h1>
{% else %}
<h1>You forgot something! Click <a href="/"> here </a> </h1>
{% endif %}
7 changes: 7 additions & 0 deletions templates/login.html~
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<title>Hello from Flask</title>
{% if name and age and fav %}
<h1>Name: {{ name }} Age: {{age}} Favorite Ninja: Patrick Huston</h1>
{% else %}
<h1>You forgot something! Click <a href="/"> here </a> </h1>
{% endif %}