-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain[Deprecrated].py
187 lines (156 loc) · 5.82 KB
/
main[Deprecrated].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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
import os
from flask import Flask, render_template, url_for, redirect, request
import content
from api import handler
from timeline_tool_new import get_groups, get_events
app = Flask(__name__)
app.config["TEMPLATES_AUTO_RELOAD"] = True
navProjects = [
{
"url": "/projects/{}".format(x),
"name": content.research[x]["navbar"]
} for x in content.research
][1:]
navLabs = [
{
"url": "/projects/{0}-ulab".format(content.labs[x]["short_name"]),
"app-url": "/labs/{}".format(content.labs[x]["short_name"]),
"name": content.labs[x]["full_name"]
} for x in content.labs
][:]
# cache useful info to prevent reloading
projects = dict()
labs = dict()
founders = None
advisors = None
team = None
@app.context_processor
def utility_processor():
return dict(navProjects=navProjects)
@app.context_processor
def utility_processor1():
return dict(navLabs=navLabs)
@app.route("/")
def index():
return render_template("main-page.html")
@app.route("/aboutus")
def aboutus():
global founders
if not founders:
founders = content.founders.copy()
for name in founders:
founders[name]['img'] = url_for('static', filename=founders[name]['img'])
global advisors
if not advisors:
advisors = content.advisors.copy()
for name in advisors:
advisors[name]['img'] = url_for('static', filename=advisors[name]['img'])
global team
if not team:
team = content.team.copy()
for name in team:
team[name]['img'] = url_for('static', filename=team[name]['img'])
return render_template("aboutus.html", founders=founders, advisors=advisors, team=team, foundersOrder=content.foundersOrder)
@app.route("/new-student")
@app.route("/new-student/<category>")
def getStudent(category="Statistical Modeling and Deep Learning"):
return render_template("new-student.html", student=content.student, jobCategory=category)
@app.route("/software-jobs")
@app.route("/software-jobs/<category>")
def getSoftware(category="ATG"):
return render_template("software-jobs.html", software_jobs=content.software_jobs, jobCategory=category, jobsOrder=content.software_jobs_order)
@app.route("/corporate-jobs")
@app.route("/corporate-jobs/<category>")
def getCorporate(category="ATG"):
return render_template("corporate-jobs.html", corporate=content.corporate, jobCategory=category)
@app.route("/lab")
@app.route("/lab/<name>")
@app.route("/lab/<name>/<category>")
@app.route("/labs")
@app.route("/labs/<name>")
@app.route("/labs/<name>/<category>")
def lab(name="placeholder", category = "Lab Management"):
global labs
if name not in labs:
labs[name] = content.labs[name].copy()
# labs[name]['img'] = url_for('static', filename=labs[name]['img'])
return render_template("labs.html", lab_jobs=labs[name], jobCategory=category)
@app.route("/project")
@app.route("/project/<name>")
@app.route("/projects")
@app.route("/projects/<name>")
def project(name="placeholder"):
global projects
if name not in projects:
projects[name] = content.research[name].copy()
projects[name]['img'] = url_for('static', filename=projects[name]['img'])
return render_template("projects.html", content=projects[name])
@app.route("/ulab-jobs")
def getJobs():
return render_template("job-landing-page.html", labs=content.labs)
@app.route("/lab-jobs")
@app.route("/lab-jobs/<name>")
def getTabs(name = "aerospace"):
global labs
if name not in labs:
labs[name] = content.labs[name].copy()
return render_template("tabs.html", lab_name=name, lab_jobs=labs[name])
@app.route("/join-page")
@app.route("/join-page/<category>")
def getJoin(category="1st Year"):
f=open("log.txt",'w')
f.write("banana \n" )
f.close()
return render_template("join-page.html", join=content.join_info, jobCategory=category, joinOrder=content.join_infoOrder)
@app.route("/bootcamp")
def bootcamp():
global founders
if not founders:
founders = content.founders.copy()
for name in founders:
founders[name]['img'] = url_for('static', filename=founders[name]['img'])
global advisors
if not advisors:
advisors = content.advisors.copy()
for name in advisors:
advisors[name]['img'] = url_for('static', filename=advisors[name]['img'])
global team
if not team:
team = content.team.copy()
for name in team:
team[name]['img'] = url_for('static', filename=team[name]['img'])
return render_template("bootcamp.html", founders=founders, advisors=advisors, team=team, foundersOrder=content.foundersOrder)
# Handling post requests for service engine
@app.route("/service-engine", methods = ['GET', 'POST'])
def service_handler():
if request.method == 'GET':
return render_template("404.html"), 204
if request.method == 'POST':
data = request.get_json()
handler.handle(data)
return render_template('404.html'), 204
# ULAB Organization Chart
@app.route("/org-chart")
def org_chart():
return render_template("TreeDiagram.html")
#Timeline Tool - NOT READY FOR DEPLOYMENT YET
@app.route("/upcoming-events")
def timelinePage():
return render_template("timelineUI.html")
@app.route("/events", methods=['POST'])
def events():
SID = request.form['inputSID']
groups = get_groups(SID)
tl = get_events(groups)
event_titles = ["Event " + str(i+1) for i in range(len(tl))]
return render_template("events.html", timeline=tl, events=event_titles)
##################### Error Handling #####################
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@app.errorhandler(500)
def internal_server_error(e):
return render_template('404.html'), 500
#################### Main App #####################
if __name__ == "__main__":
app.run(use_reloader=True, debug=True)