一、源码特点
python Django个性化电影推荐管理系统是一套完善的web设计系统mysql数据库 利用elasticsearch存储浏览数据 ,对理解python编程开发语言有帮助,系统具有完整的源代码和数据库,系统主要采用B/S模式开发。
开发环境pycharm
mysql 5.0 到5.5
elasticsearch
依赖包 Django 2.2.16
pymysql 0.8.0
知识点是 python 爬取豆瓣 elasticsearch存储,协同过滤推荐
二、功能介绍
前台功能
1)首页浏览
2)top10电影信息展现
3)电影访问、评价。系统通过协同过滤算法,结合用户浏览记录,访问A电影的时,系统根据计算矩阵算法最有可能访问的电影,推荐给用户,增加用户访问的粘性,以达到个性化推荐的目的
4)电影评价,查看公告等
后台功能:
(1)管理员管理:对管理员信息进行添加、删除、修改和查看
(2)用户管理:对用户信息进行添加、删除、修改和查看
(3)公告管理:对公告信息进行添加、删除、修改和查看
(4)电影类型管理:对电影类型信息进行添加、删除、修改和查看
(5)电影管理:对电影信息进行添加、删除、修改和查看、一次性爬取豆瓣电影信息,通过python爬取豆瓣电影信息,存储到数据库中,图片文件存在服务器中,当用户访问浏览电影信息时,
(6)电影浏览管理:对电影浏览信息进行删除、修改和查看
(7)电影评价管理:对电影评价信息进行删除、修改和查看
(8)图形化信息统计
(9)用户登录、退出、个人信息修改
models设计
#管理员表
class gly(models.Model):yhm=models.CharField(max_length=40)#用户名mm=models.CharField(max_length=40)#密码xm=models.CharField(max_length=40)#姓名#用户表
class yonghu(models.Model):yhm=models.CharField(max_length=40)#用户名mm=models.CharField(max_length=40)#密码nc=models.CharField(max_length=40)#昵称nl=models.CharField(max_length=40)#年龄xb=models.CharField(max_length=40)#性别dz=models.CharField(max_length=40)#地址yx=models.CharField(max_length=40)#邮箱#公告表
class gonggao(models.Model):bt=models.CharField(max_length=40)#标题nr=models.CharField(max_length=4000)#内容fbsj=models.CharField(max_length=40)#发布时间#电影类型表
class dylx(models.Model):lx=models.CharField(max_length=40)#类型#电影表
class dianying(models.Model):dymc=models.CharField(max_length=40)#电影名称lx=models.CharField(max_length=400)#类型jj=models.CharField(max_length=4000)#简介tp=models.CharField(max_length=400)#图片dy=models.CharField(max_length=400)#导演zy=models.CharField(max_length=400)#主演nf=models.CharField(max_length=40)#年份gj=models.CharField(max_length=400)#国家pf=models.CharField(max_length=40)#评分ll = models.IntegerField(default=0) #浏览量tj = models.CharField(max_length=40, default='否')#电影浏览表
class dyll(models.Model):dy=models.CharField(max_length=40)#电影yh=models.CharField(max_length=40)#用户sj=models.CharField(max_length=40)#时间#电影评价表
class dypj(models.Model):dy=models.CharField(max_length=40)#电影pj=models.CharField(max_length=4000)#评价yh=models.CharField(max_length=40)#用户pjsj=models.CharField(max_length=40)#评价时间
代码实现
#登录首页
def login(request):if request.method == 'GET':return render(request, "login.html")if request.method == 'POST':yhm = request.POST.get('yhm') # 用户名mm = request.POST.get('mm') # 密码qx = request.POST.get('qx') # 密码if qx == "用户":res = models.yonghu.objects.filter(yhm=yhm, mm=mm).count()if qx == "管理员":res = models.gly.objects.filter(yhm=yhm, mm=mm).count()if res == 0:messages.success(request, "操作失败、用户名和密码不匹配")return redirect('/login')elif res > 0:if qx == "用户":obj = models.yonghu.objects.filter(yhm=yhm, mm=mm).first()request.session['id'] = obj.idif qx == "管理员":obj = models.gly.objects.filter(yhm=yhm, mm=mm).first()request.session['id'] = obj.idrequest.session['yhm'] = yhmrequest.session['mm'] = mmrequest.session['qx'] = qxreturn redirect('/main')#系统首页
def main(request):return render(request, "main.html")#添加管理员
def glyadd(request):if request.method == 'GET':return render(request, "gly/glyadd.html")if request.method == 'POST':yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码xm = request.POST.get('xm') #姓名res = models.gly.objects.filter(yhm=yhm).count();if res > 0:messages.success(request, "操作失败、用户名重复")elif res == 0:messages.success(request, "操作成功")models.gly.objects.create(yhm=yhm,mm=mm,xm=xm, )#return render(request, "gly/glyadd.html")return redirect('/gly/glyadd')#管理员列表
def glylist(request):print(request.method)global listif request.method == 'GET':yhm= request.GET.get('yhm')#用户名if not yhm:yhm = ""print(yhm)list = models.gly.objects.filter(yhm__icontains=yhm).all() # 获取gly表所有的数据return render(request, "gly/glylist.html", {'list': list})
#修改管理员
def glymodify(request):# 获取要修改的数据的idif request.method == 'GET':id = request.GET.get('id')obj = models.gly.objects.get(id=id)return render(request, 'gly/glymodify.html', {'obj': obj})id = request.POST.get('id')yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码xm = request.POST.get('xm') #姓名messages.success(request, "操作成功")ret = models.gly.objects.filter(id=id).update(yhm=yhm,mm=mm,xm=xm, )return redirect('/gly/glylist')def glymod(request):# 获取要修改的数据的idif request.method == 'GET':id = request.session.get('id')obj = models.gly.objects.get(id=id)return render(request, 'gly/modify.html', {'obj': obj})id = request.POST.get('id')yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码xm = request.POST.get('xm') #姓名messages.success(request, "操作成功")ret = models.gly.objects.filter(id=id).update(yhm=yhm,mm=mm,xm=xm, )return redirect('/gly/glymod')# 管理员详情
def glydetail(request):# 获取要修改的数据的idid = request.GET.get('id')obj = models.gly.objects.get(id=id)return render(request, 'gly/glydetail.html', {'obj': obj})#管理员删除
def glydelete(request):# 获取要删除数据的idid = request.GET.get('id')# 查询数据库是否存在obj = models.gly.objects.get(id=id)if obj:# 在数据库中删除obj.delete()messages.success(request, "操作成功")return redirect('/gly/glylist')return HttpResponse("删除失败")#添加用户
def yonghuadd(request):if request.method == 'GET':return render(request, "yonghu/yonghuadd.html")if request.method == 'POST':yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码nc = request.POST.get('nc') #昵称nl = request.POST.get('nl') #年龄xb = request.POST.get('xb') #性别dz = request.POST.get('dz') #地址yx = request.POST.get('yx') #邮箱res = models.yonghu.objects.filter(yhm=yhm).count();if res > 0:messages.success(request, "操作失败、用户名重复")elif res == 0:messages.success(request, "操作成功")models.yonghu.objects.create(yhm=yhm,mm=mm,nc=nc,nl=nl,xb=xb,dz=dz,yx=yx, )#return render(request, "yonghu/yonghuadd.html")return redirect('/yonghu/yonghuadd')#用户列表
def yonghulist(request):print(request.method)global listif request.method == 'GET':yhm= request.GET.get('yhm')#用户名if not yhm:yhm = ""print(yhm)list = models.yonghu.objects.filter(yhm__icontains=yhm).all() # 获取yonghu表所有的数据return render(request, "yonghu/yonghulist.html", {'list': list})
#修改用户
def yonghumodify(request):# 获取要修改的数据的idif request.method == 'GET':id = request.GET.get('id')obj = models.yonghu.objects.get(id=id)return render(request, 'yonghu/yonghumodify.html', {'obj': obj})id = request.POST.get('id')yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码nc = request.POST.get('nc') #昵称nl = request.POST.get('nl') #年龄xb = request.POST.get('xb') #性别dz = request.POST.get('dz') #地址yx = request.POST.get('yx') #邮箱messages.success(request, "操作成功")ret = models.yonghu.objects.filter(id=id).update(yhm=yhm,mm=mm,nc=nc,nl=nl,xb=xb,dz=dz,yx=yx, )return redirect('/yonghu/yonghulist')
#修改用户
#修改用户
def yhmodify(request):# 获取要修改的数据的idif request.method == 'GET':id = request.session.get('id')obj = models.yonghu.objects.get(id=id)return render(request, 'qt/yonghumodify.html', {'obj': obj})id = request.POST.get('id')yhm = request.POST.get('yhm') #用户名mm = request.POST.get('mm') #密码nc = request.POST.get('nc') #昵称nl = request.POST.get('nl') #年龄xb = request.POST.get('xb') #性别dz = request.POST.get('dz') #地址yx = request.POST.get('yx') #邮箱messages.success(request, "操作成功")ret = models.yonghu.objects.filter(id=id).update(yhm=yhm,mm=mm,nc=nc,nl=nl,xb=xb,dz=dz,yx=yx, )return redirect('/yonghu/yhmodify')
# 用户详情
def yonghudetail(request):# 获取要修改的数据的idid = request.GET.get('id')obj = models.yonghu.objects.get(id=id)return render(request, 'yonghu/yonghudetail.html', {'obj': obj})
三、注意事项
1、管理员账号:admin密码:admin 数据库配置文件app/settings.py 更改数据库配置
2、开发环境pycharm,数据库为mysql5.0~5.5,使用python语言开发。
3、数据库文件名是pythonfilm.sql ,系统名称pythonfilm
4、系统首页地址:http://127.0.0.1:8080/qt/index
四系统实现
需要源码 其他的定制服务 下方联系卡片↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 或者私信作者