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
30 changes: 28 additions & 2 deletions flask_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
"""
Put your Flask app code here.
"""
This is a simple profile making web app that utilises Flask. -a web development
program with an importable module for Python.
"""
from flask import Flask, request
from flask import render_template
app = Flask(__name__)


@app.route('/')
def main():
return render_template('get_intel.html')


@app.route('/login', methods=['GET', 'POST'])
def make_profile():
if request.method == 'POST':
firstname = request.form["firstname"]
lastname = request.form["lastname"]
age = request.form["age"]
return render_template('profile.html', firstname=firstname,
lastname=lastname, age=age)
else:
return render_template('get_intel.html')


if __name__ == '__main__':
app.debug = True
app.run()
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
app = Flask(__name__)


@app.route('/')
def hello_world():
return 'Hello World!'
return render_template('index.html')


@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)


if __name__ == '__main__':
app.run()
22 changes: 22 additions & 0 deletions templates/get_intel.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<title>
Hi
</title>
</head>
<body>
<h1>Tell us a little bit about yourself!</h1>
<p>This is very minimal profile_building website where we definitely don'
t sell your personal information.</p>
<form action="/login" method='post'>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname"><br>
Age: <br>
<input type="text" name="age"><br>
<input type="submit" value="Make My Profile!">
</form>
</body>
</html>
7 changes: 7 additions & 0 deletions templates/hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!doctype html>
<title>Hello from Flask</title>
{% if name %}
<h1>Hello {{ name }}!</h1>
{% else %}
<h1>Hello World!</h1>
{% endif %}
12 changes: 12 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>
A Small Hello
</title>
</head>
<body>
<h1>Hi</h1>
<p>This is very minimal "hello world" HTML document.</p>
</body>
</html>
14 changes: 14 additions & 0 deletions templates/profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<title>Your Profile</title>
<h1>
Hello there {{firstname}}
</h1>
<h3>
Welcome to your personal profile.
</h3>
First Name:{{firstname}}<br>
Last Name:{{lastname}}<br>
Age: {{age}}<br>
Favorite ninja:
Patric Huston
</p>