基于Python的美食推荐系统Django景点美食管理系统(源码调试+讲解+文档)
开源的学习资料管理系统推荐 #生活技巧# #组织技巧# #学习资料管理系统#
作者:计算机源码社
个人简介:本人七年开发经验,擅长Java、微信小程序、Python、Android等,大家有这一块的问题可以一起交流!
学习资料、程序开发、技术解答、代码讲解、文档报告
JavaWeb项目
微信小程序项目
Python项目
Android项目
1、项目介绍
随着中国社会经济的快速发展,民众的生活质量不断提高,网络一直在改变这人们的生活,包括衣食住行方便都在被网络所渗透。现代生活中,人们为了缓解生活中的精神疲惫,常常选择通过美食来放松身心。随着各地美食的普及程度的提高,意味着人们的生活水平质量不断的在提高。美食不仅会带给我们视觉的享受,同时还会带来身心的一个满足。以往得知好吃的美食大多都是通过周围朋友的口述评价等,这样得知的形式过于狭义,不能代表大多数人的一个评价与口味。另外,由于每一个人的口味差异的不同,大家无法得知其他人对美食的评价。此时就需要通过一个媒介收集大家不同感受并公开于众,有了更多的声音,才能更好的去对美食做一个系统的评论与推荐。
2、核心功能模块
基于Python的美食推荐系统,选用B/S模式,应用django技术, MySQL为后台数据库。系统主要包括首页,个人中心,美景、美食推荐、地图、评论、收藏、搜索、查看美食视频、查看美景美食资讯新闻、发帖组团同游、美食分类管理、用户管理,分享管理等功能模块。
基于Python的美食推荐系统的设计与实现的设计思想如下:
1、操作简单方便、系统界面安全良好:简单明了的页面布局,方便查询景点中的美食相关信息。
2、即时可见:对美食、景点信息的处理将立马在搜索中可以查询到,从而实现“即时搜素、即时推荐”的系统功能。
基于Python的美食推荐系统的业务流程图如下所示。
1.登录流程图
2.添加信息流程图
3.注册信息流程图
3、项目展示
3.1 评论美景视频
3.2 查看美食视频
3.3 地图查看美景地点
3.4 搜索美景
3.5 美食推荐
3.6 美食资讯文章
3.7 发帖组团旅游
3.8 后台美食信息管理
4、 核心代码
def handanmeishi_list(request): ''' 前台分页 ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":10,"list":[]}} req_dict = request.session.get("req_dict") #获取全部列名 columns= handanmeishi.getallcolumn( handanmeishi, handanmeishi) #表属性[foreEndList]前台list:和后台默认的list列表页相似,只是摆在前台,否:指没有此页,是:表示有此页(不需要登陆即可查看),前要登:表示有此页且需要登陆后才能查看 try: __foreEndList__=handanmeishi.__foreEndList__ except: __foreEndList__=None if __foreEndList__=="前要登": tablename=request.session.get("tablename") if tablename!="users" and 'userid' in columns: try: req_dict['userid']=request.session.get("params").get("id") except: pass #forrEndListAuth try: __foreEndListAuth__=handanmeishi.__foreEndListAuth__ except: __foreEndListAuth__=None #authSeparate try: __authSeparate__=handanmeishi.__authSeparate__ except: __authSeparate__=None if __foreEndListAuth__ =="是" and __authSeparate__=="是": tablename=request.session.get("tablename") if tablename!="users": req_dict['userid']=request.session.get("params",{"id":0}).get("id") tablename = request.session.get("tablename") if tablename == "users" and req_dict.get("userid") != None:#判断是否存在userid列名 del req_dict["userid"] else: __isAdmin__ = None allModels = apps.get_app_config('main').get_models() for m in allModels: if m.__tablename__==tablename: try: __isAdmin__ = m.__isAdmin__ except: __isAdmin__ = None break if __isAdmin__ == "是": if req_dict.get("userid"): del req_dict["userid"] else: #非管理员权限的表,判断当前表字段名是否有userid if "userid" in columns: try: # 本接口可以匿名访问,所以try判断是否为匿名 req_dict['userid']=request.session.get("params").get("id") except: pass #当列属性authTable有值(某个用户表)[该列的列名必须和该用户表的登陆字段名一致],则对应的表有个隐藏属性authTable为”是”,那么该用户查看该表信息时,只能查看自己的 try: __authTables__=handanmeishi.__authTables__ except: __authTables__=None if __authTables__!=None and __authTables__!={} and __foreEndListAuth__=="是": try: del req_dict['userid'] except: pass for authColumn,authTable in __authTables__.items(): if authTable==tablename: params = request.session.get("params") req_dict[authColumn]=params.get(authColumn) break if handanmeishi.__tablename__[:7]=="discuss": try: del req_dict['userid'] except: pass msg['data']['list'], msg['data']['currPage'], msg['data']['totalPage'], msg['data']['total'], \ msg['data']['pageSize'] = handanmeishi.page(handanmeishi, handanmeishi, req_dict) return JsonResponse(msg) def handanmeishi_save(request): ''' 后台新增 ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} req_dict = request.session.get("req_dict") tablename=request.session.get("tablename") __isAdmin__ = None allModels = apps.get_app_config('main').get_models() for m in allModels: if m.__tablename__==tablename: try: __isAdmin__ = m.__isAdmin__ except: __isAdmin__ = None break #获取全部列名 columns= handanmeishi.getallcolumn( handanmeishi, handanmeishi) if tablename!='users' and req_dict.get("userid")!=None and 'userid' in columns and __isAdmin__!='是': params=request.session.get("params") req_dict['userid']=params.get('id') error= handanmeishi.createbyreq(handanmeishi,handanmeishi, req_dict) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_add(request): ''' 前台新增 ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} req_dict = request.session.get("req_dict") #获取全部列名 columns= handanmeishi.getallcolumn( handanmeishi, handanmeishi) try: __authSeparate__=handanmeishi.__authSeparate__ except: __authSeparate__=None if __authSeparate__=="是": tablename=request.session.get("tablename") if tablename!="users" and 'userid' in columns: try: req_dict['userid']=request.session.get("params").get("id") except: pass try: __foreEndListAuth__=handanmeishi.__foreEndListAuth__ except: __foreEndListAuth__=None if __foreEndListAuth__ and __foreEndListAuth__!="否": tablename=request.session.get("tablename") if tablename!="users": req_dict['userid']=request.session.get("params").get("id") error= handanmeishi.createbyreq(handanmeishi,handanmeishi, req_dict) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_thumbsup(request,id_): ''' 点赞:表属性thumbsUp[是/否],刷表新增thumbsupnum赞和crazilynum踩字段, ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} req_dict = request.session.get("req_dict") id_=int(id_) type_=int(req_dict.get("type",0)) rets=handanmeishi.getbyid(handanmeishi,handanmeishi,id_) update_dict={ "id":id_, } if type_==1:#赞 update_dict["thumbsupnum"]=int(rets[0].get('thumbsupnum'))+1 elif type_==2:#踩 update_dict["crazilynum"]=int(rets[0].get('crazilynum'))+1 error = handanmeishi.updatebyparams(handanmeishi,handanmeishi, update_dict) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_info(request,id_): ''' ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} data = handanmeishi.getbyid(handanmeishi,handanmeishi, int(id_)) if len(data)>0: msg['data']=data[0] #浏览点击次数 try: __browseClick__= handanmeishi.__browseClick__ except: __browseClick__=None if __browseClick__=="是" and "clicknum" in handanmeishi.getallcolumn(handanmeishi,handanmeishi): try: clicknum=int(data[0].get("clicknum",0))+1 except: clicknum=0+1 click_dict={"id":int(id_),"clicknum":clicknum} ret=handanmeishi.updatebyparams(handanmeishi,handanmeishi,click_dict) if ret!=None: msg['code'] = crud_error_code msg['msg'] = ret return JsonResponse(msg) def handanmeishi_detail(request,id_): ''' ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} data =handanmeishi.getbyid(handanmeishi,handanmeishi, int(id_)) if len(data)>0: msg['data']=data[0] #浏览点击次数 try: __browseClick__= handanmeishi.__browseClick__ except: __browseClick__=None if __browseClick__=="是" and "clicknum" in handanmeishi.getallcolumn(handanmeishi,handanmeishi): try: clicknum=int(data[0].get("clicknum",0))+1 except: clicknum=0+1 click_dict={"id":int(id_),"clicknum":clicknum} ret=handanmeishi.updatebyparams(handanmeishi,handanmeishi,click_dict) if ret!=None: msg['code'] = crud_error_code msg['msg'] = retfo return JsonResponse(msg) def handanmeishi_update(request): ''' ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} req_dict = request.session.get("req_dict") if req_dict.get("mima") and req_dict.get("password"): if "mima" not in handanmeishi.getallcolumn(handanmeishi,handanmeishi) : del req_dict["mima"] if "password" not in handanmeishi.getallcolumn(handanmeishi,handanmeishi) : del req_dict["password"] try: del req_dict["clicknum"] except: pass error = handanmeishi.updatebyparams(handanmeishi, handanmeishi, req_dict) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_delete(request): ''' 批量删除 ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code, "data": {}} req_dict = request.session.get("req_dict") error=handanmeishi.deletes(handanmeishi, handanmeishi, req_dict.get("ids") ) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_vote(request,id_): ''' 浏览点击次数(表属性[browseClick:是/否],点击字段(clicknum),调用info/detail接口的时候后端自动+1)、投票功能(表属性[vote:是/否],投票字段(votenum),调用vote接口后端votenum+1) 统计商品或新闻的点击次数;提供新闻的投票功能 ''' if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": mes.normal_code} data= handanmeishi.getbyid(handanmeishi, handanmeishi, int(id_)) for i in data: votenum=i.get('votenum') if votenum!=None: params={"id":int(id_),"votenum":votenum+1} error=handanmeishi.updatebyparams(handanmeishi,handanmeishi,params) if error!=None: msg['code'] = crud_error_code msg['msg'] = error return JsonResponse(msg) def handanmeishi_importExcel(request): if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": "成功", "data": {}} excel_file = request.FILES.get("file", "") file_type = excel_file.name.split('.')[1] if file_type in ['xlsx', 'xls']: data = xlrd.open_workbook(filename=None, file_contents=excel_file.read()) table = data.sheets()[0] rows = table.nrows try: for row in range(1, rows): row_values = table.row_values(row) req_dict = {} handanmeishi.createbyreq(handanmeishi, handanmeishi, req_dict) except: pass else: msg.code = 500 msg.msg = "文件类型错误" return JsonResponse(msg) def handanmeishi_sendemail(request): if request.method in ["POST", "GET"]: req_dict = request.session.get("req_dict") code = random.sample(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 4) to = [] to.append(req_dict['email']) send_mail('用户注册', '您的注册验证码是【'+''.join(code)+'】,请不要把验证码泄漏给其他人,如非本人请勿操作。', 'yclw9@qq.com', to, fail_silently = False) cursor = connection.cursor() cursor.execute("insert into emailregistercode(email,role,code) values('"+req_dict['email']+"','用户','"+''.join(code)+"')") msg = { "msg": "发送成功", "code": 0 } return JsonResponse(msg) def handanmeishi_autoSort2(request): if request.method in ["POST", "GET"]: req_dict = request.session.get("req_dict") cursor = connection.cursor() leixing = set() try: cursor.execute("select goodtype from orders where userid = %d"%(request.session.get("params").get("id"))+" and tablename = 'handanmeishi' order by addtime desc") rows = cursor.fetchall() for row in rows: for item in row: leixing.add(item) except: leixing = set() L = [] cursor.execute("select * from handanmeishi where meishifenlei in ('%s"%("','").join(leixing)+"') union all select * from handanmeishi where meishifenlei not in('%s"%("','").join(leixing)+"')") desc = cursor.description data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] for online_dict in data_dict: for key in online_dict: if 'datetime.datetime' in str(type(online_dict[key])): online_dict[key] = online_dict[key].strftime( "%Y-%m-%d %H:%M:%S") else: pass L.append(online_dict) return JsonResponse({"code": 0, "msg": '', "data":{"currPage":1,"totalPage":1,"total":1,"pageSize":5,"list": L[0:6]}}) def handanmeishi_value(request, xColumnName, yColumnName, timeStatType): if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": "成功", "data": {}} where = ' where 1 = 1 ' sql = '' if timeStatType == '日': sql = "SELECT DATE_FORMAT({0}, '%Y-%m-%d') {0}, sum({1}) total FROM handanmeishi {2} GROUP BY DATE_FORMAT({0}, '%Y-%m-%d')".format(xColumnName, yColumnName, where, '%Y-%m-%d') if timeStatType == '月': sql = "SELECT DATE_FORMAT({0}, '%Y-%m') {0}, sum({1}) total FROM handanmeishi {2} GROUP BY DATE_FORMAT({0}, '%Y-%m')".format(xColumnName, yColumnName, where, '%Y-%m') if timeStatType == '年': sql = "SELECT DATE_FORMAT({0}, '%Y') {0}, sum({1}) total FROM handanmeishi {2} GROUP BY DATE_FORMAT({0}, '%Y')".format(xColumnName, yColumnName, where, '%Y') L = [] cursor = connection.cursor() cursor.execute(sql) desc = cursor.description data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] for online_dict in data_dict: for key in online_dict: if 'datetime.datetime' in str(type(online_dict[key])): online_dict[key] = online_dict[key].strftime( "%Y-%m-%d %H:%M:%S") else: pass L.append(online_dict) msg['data'] = L return JsonResponse(msg) def handanmeishi_o_value(request, xColumnName, yColumnName): if request.method in ["POST", "GET"]: msg = {"code": normal_code, "msg": "成功", "data": {}} where = ' where 1 = 1 ' sql = "SELECT {0}, sum({1}) AS total FROM handanmeishi {2} GROUP BY {0}".format(xColumnName, yColumnName, where) L = [] cursor = connection.cursor() cursor.execute(sql) desc = cursor.description data_dict = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] for online_dict in data_dict: for key in online_dict: if 'datetime.datetime' in str(type(online_dict[key])): online_dict[key] = online_dict[key].strftime( "%Y-%m-%d %H:%M:%S") else: pass L.append(online_dict) msg['data'] = L return JsonResponse(msg) def handanmeishi_alipay(request): if request.method in ["POST", "GET"]: alipay = AliPay( appid=settings.ALIPAY_APP_ID, app_notify_url=None, app_private_key_string=settings.APP_PRIVATE_KEY_STRING, alipay_public_key_string=settings.ALIPAY_PUBLIC_KEY_STRING, sign_type=settings.ALIPAY_SIGN_TYPE, debug=True, config=AliPayConfig(timeout=15) ) req_dict = request.session.get("req_dict") order_string = alipay.api_alipay_trade_page_pay( out_trade_no=req_dict['tradeno'], total_amount=req_dict['totalamount'], subject=req_dict['subject'], return_url='http://localhost:8080/django59v1e/handanmeishi/notify', #notify_url='' ) pay_url = 'https://openapi.alipaydev.com/gateway.do?' + order_string pay_url = '<form name="punchout_form" method="post" action="{0}"><input type="hidden" name="biz_content" ><input type="submit" value="立即支付" style="display: none"></form>'.format(pay_url) return JsonResponse({'code': 0, "data": pay_url}) def handanmeishi_notify(request): if request.method in ["POST", "GET"]: req_dict = request.session.get("req_dict") out_trade_no = req_dict['out_trade_no'] cursor = connection.cursor() return redirect('http://localhost:8080/django59v1e/admin/dist/index.html#/handanmeishi') 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483'
网址:基于Python的美食推荐系统Django景点美食管理系统(源码调试+讲解+文档) https://www.yuejiaxmz.com/news/view/338795
相关内容
探索美食新世界:基于Python的美食推荐系统基于小程序的健康食谱推荐系统设计与实现(源码+文档+指导)
基于SSM美食食谱管理系统Java家庭食谱安排系统的设计与实现(源码调试+讲解+文档)
基于springboot+vue的个人健康管理系统(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue的智慧社区生活服务缴费系统(源码+LW+调试文档+讲解)
django+hadoop基于Python的王者荣耀战队的数据分析系统(源码+文档+调试+可视化大屏)
【Python项目】基于Django的膳食健康系统图文介绍
python基于大数据的食物推荐系统
基于python的膳食健康推荐系统
(开题报告)django+vueJavaMySQL的旧物回收系统论文+源码