-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
210 lines (203 loc) · 5.85 KB
/
web.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
from flask import Flask, render_template, request, jsonify
from py import query, get_data
app=Flask(__name__,template_folder='web',static_folder='static')
@app.route('/')
def index():
try:
if not query.data2017().count()&query.data2016().count()&query.data2015().count()&query.data2014().count()\
&query.data2013().count()&query.enrollment_rate().count()&query.students_rate().count()\
&query.graduate_rate().count()&query.gae2017().count()&query.gae2016().count()\
&query.gae2015().count()&query.gae2014().count()&query.gae2013().count()\
&query.population().count()&query.sip2017().count()&query.sip2016().count() \
& query.sip2015().count()&query.sip2014().count()&query.sip2013().count():
get_data.insert()
else:
pass
finally:
return render_template('index.html')
#各年份的学生数据
@app.route('/data2017',methods=['GET','POST'])
def data2017():
if request.method=='POST':
data= query.data2017()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/data2016',methods=['GET','POST'])
def data2016():
if request.method=='POST':
data= query.data2016()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/data2015',methods=['GET','POST'])
def data2015():
if request.method=='POST':
data= query.data2015()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/data2014',methods=['GET','POST'])
def data2014():
if request.method=='POST':
data= query.data2014()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/data2013',methods=['GET','POST'])
def data2013():
if request.method=='POST':
data= query.data2013()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
#招生、在校、毕业人数增长率
@app.route('/enrollmentRate',methods=['GET','POST'])
def enrollment_rate():
if request.method=='POST':
data=query.enrollment_rate()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/studentsRate',methods=['GET','POST'])
def sutdents_rate():
if request.method=='POST':
data=query.students_rate()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/graduateRate',methods=['GET','POST'])
def graduate_rate():
if request.method=='POST':
data=query.graduate_rate()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
#各年份的高中职毕业生数和专本科招生数
@app.route('/gae2017',methods=['GET','POST'])
def gae2017():
if request.method=='POST':
data= query.gae2017()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/gae2016',methods=['GET','POST'])
def gae2016():
if request.method=='POST':
data= query.gae2016()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/gae2015',methods=['GET','POST'])
def gae2015():
if request.method=='POST':
data= query.gae2015()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/gae2014',methods=['GET','POST'])
def gae2014():
if request.method=='POST':
data= query.gae2014()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/gae2013',methods=['GET','POST'])
def gae2013():
if request.method=='POST':
data= query.gae2013()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
#各年份的总人口中的在校生占比
@app.route('/sip2017',methods=['GET','POST'])
def sip2017():
if request.method=='POST':
data= query.sip2017()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/sip2016',methods=['GET','POST'])
def sip2016():
if request.method=='POST':
data= query.sip2016()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/sip2015',methods=['GET','POST'])
def sip2015():
if request.method=='POST':
data= query.sip2015()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/sip2014',methods=['GET','POST'])
def sip2014():
if request.method=='POST':
data= query.sip2014()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
@app.route('/sip2013',methods=['GET','POST'])
def sip2013():
if request.method=='POST':
data= query.sip2013()
results=[]
for i in data:
results.append(i)
return jsonify(results)
else:
return 'request error'
if __name__=='__main__':
app.run()