-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
40 lines (34 loc) · 879 Bytes
/
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
import sqlite3
from flask import Flask,render_template
app = Flask(__name__)
@app.route('/index')
def index():
score = []
num = []
con = sqlite3.connect("movie.db")
cur = con.cursor()
sql = "select score,count(score) from movie250 group by score"
data = cur.execute(sql)
for item in data:
score.append(item[0])
num.append(item[1])
cur.close()
con.close()
return render_template("index.html",score=score,num=num)
@app.route('/')
def home():
return index()
@app.route('/movie')
def movie():
datalist = []
con = sqlite3.connect("movie.db")
cur = con.cursor()
sql = "select * from movie250"
data = cur.execute(sql)
for item in data:
datalist.append(item)
cur.close()
con.close()
return render_template("movie.html",movies=datalist)
if __name__ == '__main__':
app.run()