-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.py
72 lines (56 loc) · 2.2 KB
/
index.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
import re
from course_list import courseJson
from student import studentpolicyJSON
from flask import Flask, render_template, request, jsonify, abort
from research_list import labsJSON, facultyJson, researchJson, studentsJSON2017, studentsJSON2018, publicationsJSON
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
app.url_map.strict_slashes=False
@app.route("/")
def index():
return render_template('index.html')
@app.route("/student-policy/")
def policy():
temp= render_template('policy.html', policy_list= studentpolicyJSON)
return re.sub(' +', ' ', ''.join(temp.split('\n')))
@app.route("/btech-courses/")
def courses():
return render_template('courses.html', courses_list= courseJson)
@app.route("/phd/")
def coursesphd():
return render_template('phd.html')
@app.route("/research/")
def research():
return render_template('research.html')
@app.route("/research-publications/")
def research_publications():
return render_template('research_publications.html', research_list= publicationsJSON)
@app.route("/research-labs/")
def research_labs():
return render_template('research_labs.html', labs_list= labsJSON)
@app.route("/contact/")
def contact():
temp= render_template('contact.html')
return re.sub(' +', ' ', ''.join(temp.split('\n')))
@app.route("/faculty/")
def faculty():
temp= render_template('faculty.html', faculty_list= facultyJson, tags= request.args.get('tags'))
return re.sub(' +', ' ', ''.join(temp.split('\n')))
@app.route("/students/")
def students():
temp= render_template('students.html', students_list= studentsJSON2017, students_list_1= studentsJSON2018, year= request.args.get('year'))
return re.sub(' +', ' ', ''.join(temp.split('\n')))
@app.errorhandler(404)
def page_not_found(e):
return re.sub(' +', ' ', ''.join(render_template('404.html').split('\n'))), 404
@app.route("/sitemap.xml/")
def sitemap():
return render_template('sitemap.xml')
@app.route("/robots.txt/")
def toboots():
return render_template('robots.txt')
@app.route('/service-worker.js')
def sw():
return app.send_static_file('service-worker.js'), 200, {'Content-Type': 'text/javascript'}
if __name__ == "__main__":
app.run(debug= True, port= 4001)