2 Star 40 Fork 12

picky-xxx/Flask框架+Python爬虫+ECharts+BootStrap+WordCloud搭建数据可视化网页

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.py 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
picky-xxx 提交于 2020-10-18 13:36 . add files
from flask import Flask,render_template
import sqlite3
app = Flask(__name__)
@app.route('/')
def home():
return render_template("index.html")
@app.route('/index')
def home1():
# return render_template("index.html")
return home()
@app.route('/index.html')
def index():
return home()
@app.route('/movie')
def movie():
datalist = []
con=sqlite3.connect("movie.db")
cur=con.cursor()
sql = "select * from movie"
data = cur.execute(sql)
for item in data: #若执行后直接关掉数据库相应的数据也会消失
datalist.append(item)
cur.close()
con.close()
return render_template("movie.html",movies=datalist)
@app.route('/score')
def score():
datalist = []
score = [] #评分
num = [] #评分人数
con=sqlite3.connect("movie.db")
cur=con.cursor()
sql = "select score,count(score) from movie group by score"
data = cur.execute(sql)
for item in data: #若执行后直接关掉数据库相应的数据也会消失
score.append(item[0]) #str(item[0])
num.append(item[1])
cur.close()
con.close()
return render_template("score.html",score=score,num=num)
@app.route('/clouds')
def clouds():
return render_template("clouds.html")
@app.route('/team')
def team():
return render_template("team.html")
@app.route('/test')
def test():
return render_template("test.html")
if __name__ == '__main__':
app.run(host="0.0.0.0",debug=True)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/picky-xxx/flask_movie.git
git@gitee.com:picky-xxx/flask_movie.git
picky-xxx
flask_movie
Flask框架+Python爬虫+ECharts+BootStrap+WordCloud搭建数据可视化网页
master

搜索帮助