forked from kaybhutani/jiit-timetable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
57 lines (43 loc) · 1.25 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
#importing files
from flask import Flask,render_template,request,redirect,url_for,send_from_directory
import os
import imgkit
import secondyear
import thirdyear
import firstyear
import fourthyear
#app name
app=Flask(__name__)
#app route for main page
@app.route('/', methods=['GET', 'POST'])
def home():
#deleting all file in the folder
# folder = 'static/temp/'
# for the_file in os.listdir(folder):
# file_path = os.path.join(folder, the_file)
# try:
# if os.path.isfile(file_path):
# os.unlink(file_path)
# except Exception as e:
# print(e)
if request.method == 'GET':
return render_template("index.html")
elif request.method == 'POST':
year=int(request.form.get('year'))
batch=request.form.get('batch').upper()
#returning dictionary from module
if year==2:
tt_dict=secondyear.second(batch)
elif year==3:
tt_dict=thirdyear.third(batch)
elif year==1:
tt_dict=firstyear.first(batch)
elif year==4:
tt_dict=fourthyear.fourth(batch)
try:
pass
except Exception as e:
return render_template("timetable.html",tt_dict=tt_dict)
return render_template("timetable.html",tt_dict=tt_dict)
if(__name__=='__main__'):
app.run(debug=True,use_reloader=True)