-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
92 lines (71 loc) · 2.32 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"""
Title: app.py
Author: Eoin Farrell
Student No: C00164354
DOC: 30/10/2020
CA2 Update: 24/11/2020
"""
from flask import Flask, render_template, request
from data_utils import save_data, get_data
app = Flask(__name__)
# Render functions for each page on personal site.
@app.route("/")
def display_homepage():
return render_template(
"index.html",
main_title="The Eoin Zone",
pageHeaderMsg="",
userName="Visitor",
open_message="If you would be so kind as to sign the guestbook before continuing, I would be so grateful",
data=get_data(),
)
def display_homepage(guest_Signed="Stranger"):
"""
display_homepage overload in the event a visitor signs the guestbook
without a name.
"""
return render_template(
"index.html",
main_title="The Eoin Zone",
userName=guest_Signed,
open_message="Feel free to check out this website through the menu above!",
data=get_data(),
)
@app.route("/processForm", methods=["POST"])
def process_form_data():
"""
processForm gathers form data, calls the save_data function from data_utils,
saving the signature to the database and returns the user to the homepage.
"""
data = request.form
save_data(data)
if data["userName"] == "":
return display_homepage()
return display_homepage(data["userName"])
@app.route("/personalPage")
def personalPage():
return render_template(
"personalPage.html",
main_title="About Me!",
pageHeaderMsg="You want to know about me!?",
)
@app.route("/CV")
def cv():
return render_template("CV.html", main_title="Professional Details")
@app.route("/techHub")
def techInterests():
return render_template(
"techHub.html", main_title="What Draws Me To Soft. Engineering"
)
@app.route("/assistiveTech")
def assistiveTech():
return render_template("assistiveTech.html", main_title="Assistive Tech!")
@app.route("/arduino")
def arduino():
return render_template("arduino.html", main_title="The Power of Uno!")
@app.route("/VR")
def VR():
return render_template("virtualReality.html", main_title="VR!")
@app.route("/personalInterests")
def personalInterests():
return render_template("personalInterests.html", main_title="Personal Interests!")