计算机毕业设计选题推荐-智能菜谱推荐系统-Python项目实战

作者主页:IT研究室✨
个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。
☑文末获取源码☑
精彩专栏推荐⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目

一、前言

随着科技的进步和全球化的推进,人们的饮食文化也日益多元化,对菜谱的需求也变得更为复杂和个性化。传统的纸质菜谱或者简单的网站菜谱已经不能满足人们的需求。人们需要一个智能的菜谱推荐系统,能够根据个人的口味、饮食偏好和健康需求等信息,提供个性化的菜谱推荐。同时,对于管理员来说,也需要一个高效的菜谱管理系统,能够有效地管理菜谱信息、用户信息和各种统计数据。

然而,现有的解决方案往往存在着一些问题。首先,对于用户来说,单一的菜谱推荐模式往往不能满足他们的需求,无法根据个人的口味和需求进行个性化的推荐。其次,对于管理员来说,缺乏有效的工具来管理和分析菜谱数据,无法根据用户的反馈和需求进行及时的调整和优化。

因此,智能菜谱推荐系统的研究具有重要的必要性。该系统不仅能够提供个性化的菜谱推荐服务,满足用户的个性化需求,同时也能提供有效的管理工具,帮助管理员更好地管理和分析菜谱数据。

本课题的研究目的是开发一个智能菜谱推荐系统,该系统能够根据用户的需求和口味等信息,提供个性化的菜谱推荐服务。同时,对于管理员来说,该系统也能提供有效的管理工具,帮助其更好地管理和分析菜谱数据。具体来说,本课题的研究目的包括以下几个方面:
研究用户行为和需求:通过分析用户的行为和反馈等信息,了解用户的需求和口味偏好,为个性化菜谱推荐提供依据。
设计智能推荐算法:根据用户的需求和口味等信息,设计一种智能的推荐算法,实现个性化的菜谱推荐。
开发高效的管理工具:为管理员开发一种高效的管理工具,能够帮助其更好地管理和分析菜谱数据。
实现系统的可扩展性和可维护性:为了保证系统的稳定性和可用性,需要实现系统的可扩展性和可维护性。

智能菜谱推荐系统的研究具有重要的意义。首先,该系统能够满足用户的个性化需求,提供个性化的菜谱推荐服务,提高用户的饮食质量和健康水平。其次,该系统能够帮助管理员更好地管理和分析菜谱数据,提高管理效率和管理质量。最后,该系统的成功开发也将推动相关领域的研究和应用,具有重要的理论和实践价值。

二、开发环境

  • 开发语言:Python
  • 数据库:MySQL
  • 系统架构:B/S
  • 后端:Django/Flask两个版本
  • 前端:Vue

三、系统功能模块

  • 角色:用户、管理员
  • 功能:
    用户
    菜谱信息、菜谱推荐、评分、公告信息、留言;
    管理员
    用户管理、类型管理、菜品信息管理、评分信息管理、留言管理、公告管理、菜谱分类统计图、菜谱评分统计图、每日评分人数统计图。

四、系统界面展示

  • 智能菜谱推荐系统-界面展示:
    智能菜谱推荐系统-菜品信息
    智能菜谱推荐系统-菜品详情
    智能菜谱推荐系统-菜谱评分
    智能菜谱推荐系统-数据可视化
    智能菜谱推荐系统-菜谱信息管理
    智能菜谱推荐系统-评分信息管理
    智能菜谱推荐系统-留言信息管理

五、代码参考

  • 智能菜谱推荐系统-代码参考:
# 1-2 使用Flask创建一个flask对象
app = Flask(__name__)

# 1-3 连接MongoDB数据库(数据库名称:menu,集合名称:content)
client = pymongo.MongoClient(host='127.0.0.1', port=27017)
menu = client['menu']
content = menu['content' ]
menu_info = menu['menu_info']
# 集合名称menu_2用来菜谱的数据
menu_2 = menu['menu_2']
info = menu['info' ]

# 1-4集合名称users_info用来存储用户信息
users_info = menu['users_info']
#集合名称users_content用来存储用户的数据
users_content = menu['users_content']


# 1-5 点击 http://127.0.0.1:5000/ 跳转到美食汇的首页
@app.route('/')
def index():
    return render_template('index.html')

# 1-6 注册路由
@app.route('/register',methods=['GET','POST'])
def register():
    # 注册分两种请求,get请求表示从首页访问,然后跳转到注册页面
    if request.method == 'GET':
        return render_template('register.html')
    #如果是post请求,则说明这个请求是一个注册请求,进行注册操作
    elif request.method == 'POST':
        #获取表单中的用户名和密码
        #表单中用户名密码的键由前端的表单元素的name属性决定
        username = request.form.get('username')
        password = request.form.get('password')
        #判断用户名和密码是否为空
        if username == '':
            #如果用户名为空,则跳转到注册页面并提示用户
            return render_template('register.html',success=False,info='用户名为空,请重新注册')
        elif password == '':
            #如果密码为空,则跳转到注3册页面并提示用户
            return render_template('register.html', success=False, info='密码为空,请重新注册')
        #1.判断用户名是否已经存在
        if users_info.count_documents({'username':username}) == 0:
            #2.用户名不存在,则将数据插入到数据库中
            data = {
                'username':username,
                'password':password
            }
            users_info.insert_one(data)
            #3.跳转到登录界面并提示用户登录(success表示注册成功,info就是提示语句)
            return render_template('login.html',success=True,info='注册成功,快来登录吧ヾ(≧▽≦*)o')
        else:
            #2.用户名存在,跳转到注册页面并提示用户
            return render_template('register.html',success=False,info='注册失败,用户名已存在了ψ(._. )>')


# 1-7 登录路由
@app.route('/login',methods=['GET','POST'])
def login():
    #登录操作记得维持登录状态,维持登录状态需要借助session
    #session本质上是一个字典
    #使用session维持登录状态的步骤如下:
    #1.从flask里面导入session(from flask import session)
    #2.处于安全考虑,使用session必须配置密钥(app.config['SECRET_KEY'] = 密钥)
    #3.往session里面存一个键值对,用于判断登录状态(session['logined_in'] = True)
    # session['logined_in'] = True
    # return redirect('/')

    #判断请求的方法
    if request.method == 'GET':
        #如果是get请求,说明是首页跳转过来登录的
        if session.get('logined'):
            # 如果用户已经登录,跳转到首页
            return redirect('/')
        else:
            #如果用户还没有登录,跳转到登录页面
            return render_template('login.html')
    else:
        #如果是post请求,说明这个请求是一个登录请求
        #1.获取用户名和密码
        username = request.form.get('username')
        password = request.form.get('password')
        #2.校验用户名密码是否为空
        if username == '':
            #用户名为空,跳转到登录页面并提示用户用户名为空
            return render_template('login.html',success=False,info='用户名为空,请重新输入')
        elif password == '':
            #密码为空,跳转到登录页面并提示用户密码为空
            return render_template('login.html', success=False, info='密码为空,请重新输入')
            # 3.判断用户是否存在
        if users_info.count_documents({'username': username}):
            # 用户存在
            # 判断密码是否正确
            # if users_info.find_one({'username': username}).get('password') == password:
            if users_info.find({'username': username})[0].get('password') == password:
                # 4.维持登录状态
                # 保存登录状态,用于后面判断是否已经登录
                session['logined'] = True
                # 保存用户名,用于后面获取用户数据时提供用户名
                session['username'] = request.form.get('username')
                # 5.跳转到首页
                return redirect('/')
            else:
                # 密码错误,跳转到登录页面并提示用户密码错误
                return render_template('login.html', success=False, info='密码错误,请重新登录')
        else:
            # 用户名不存在,跳转到登录页面并提示用户用户名不存在
            return render_template('register.html', success=False, info='用户名不存在,请重新注册')

# 注销路由
@app.route('/logout')
def logout():
    #解除登录状态步骤
    #1.将session里面的值清空
    session.clear()
    return redirect('/')

@app.route('/health')
def health():
        return render_template('health.html')

@app.route('/MainFood')
def MainFood():
        return render_template('MainFood.html')

@app.route('/SweetFood')
def SweetFood():
    return render_template('SweetFood.html')

@app.route('/cookie')
def cookie():
    if session.get('logined'):
        return render_template('cookie.html')
    else:
        return render_template('login.html',success = False ,info = '亲,请登录后再来ψ(._. )>')

@app.route('/AboutUs')
def AboutUs():
    return render_template('AboutUs.html')

@app.route('/ContactUs')
def ContactUs():
    return render_template('ContactUs.html')

@app.route('/Music')
def Music():
    return render_template('Music.html')

# 了解更多
@app.route('/water')
def water():
    if session.get('logined'):
        return render_template('water.html')
    else:
        return render_template('login.html', success=False, info='亲,请登录后再来ψ(._. )>')


@app.route('/milk')
def milk():
    if session.get('logined'):
        return render_template('milk.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')

@app.route('/banner')
def banner():
    if session.get('logined'):
        return render_template('banner.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')

@app.route('/lw')
def lw():
    if session.get('logined'):
        return render_template('lw.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')


@app.route('/sbl')
def sbl():
    if session.get('logined'):
        return render_template('sbl.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')

@app.route('/mcx')
def mcx():
    if session.get('logined'):
        return render_template('mcx.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')

@app.route('/yxc')
def yxc():
    if session.get('logined'):
        return render_template('yxc.html')
    else:
        return render_template('login.html',success = False,info = '亲,请登录后再来ψ(._. )>')

@app.route('/yougan')
def yougan():
    if session.get('logined'):
        return render_template('yougan.html')
    else:
        return render_template('login.html', success=False, info='亲,请登录后再来ψ(._. )>')

@app.route('/Cherries')
def Cherries():
    if session.get('logined'):
        return render_template('Cherries.html')
    else:
        return render_template('login.html', success=False, info='亲,请登录后再来ψ(._. )>')

@app.route('/tuichu')
def tuichu():
    return render_template('health.html')

#MainFood
@app.route('/menu')
def menu():
    if session.get('logined'):
        x1 = menu_info.find({}).limit(8)
        return render_template('menu.html', x1=x1, pp=1, pn=2)
    else:
        x1 = menu_info.find({}).limit(8)
        return render_template('menu.html', x1=x1)

@app.route("/menu/<int:page_index>")
def page(page_index):
    if session.get('logined'):
        page_number = 8
        skip_num = (page_index - 1) * page_number
        x1 = menu_info.find().skip(skip_num).limit(page_number)
        pp = page_index-1
        pn = page_index+1
        if pp == 0:
            pp = 1
        if pn == 8:
            pn = 7
        return render_template("menu.html", x1=x1, page_index=page_index, pg=8, pp=pp, pn=pn)
    else:
        return render_template('login.html')


@app.route('/recipe.html/<page_index>')
def recipe(page_index):
    myquery = {"_id": page_index}
    x2 = menu_info.find(myquery)
    return render_template("recipe.html", x2=x2)



@app.route('/Contactus')
def Contactus():
   return render_template('ContactUs.html')

@app.route('/index')
def fanhui():
    return render_template('index.html')



@app.route('/name1')
def name1():
    return redirect('/page/1')

@app.route('/page/<int:page_index>')
def page1(page_index):
    # 分页情况不用获取id
    # _id = request.form.get('id')
    # 分页情况遍历数据库id内容
    # data = list(menu_2.find())
    # 每页显示5条数据
    page_number = 5
    # skip_number表示跳过数据的条数
    # page_index表示页码
    skip_number = (page_index - 1) * page_number
    data = list(menu_2.find().skip(skip_number).limit(page_number))
    # 计算页数,页数=(这个用户所有数据的条数/每页显示的数据的条数)然后向上取整
    pages = math.ceil(menu_2.count_documents({}) / page_number)
    # 计算页数
    page_index = [i for i in range(1, pages+1)]
    # 查询完数据后,跳转到首页展示
    return render_template('jiqiao.html', data=data, page_index=page_index)



@app.route('/event_data')
def add():
    names = request.args.get('names')
    lianxi = request.args.get('lianxi')
    wenti = request.args.get('wenti')
    beizhu = request.args.get('beizhu')

    data = {
        'names': names,
        'lianxi': lianxi,
        'wenti': wenti,
        'beizhu': beizhu
    }
    if names == '':

        return render_template('ContactUs.html', success=False, info='')
    elif lianxi == '':

        return render_template('ContactUs.html', success=False, info='')

    elif wenti == '':

        return render_template('ContactUs.html', success=False, info='')
    elif beizhu == '':

        return render_template('ContactUs.html', success=False, info='')
    print(data)

    info.insert_one(data)
    return render_template('index.html')



if __name__ == '__main__':
    # 配置session所需要的密钥
    app.config['SECRET_KEY'] = 'root'
    app.run(debug=True)
# 显示菜品列表
def list_recipes(request):
    recipes = Recipe.objects.all()
    return render(request, 'admin/list_recipes.html', {'recipes': recipes})

# 创建新菜品
def create_recipe(request):
    if request.method == 'POST':
        # 从表单获取数据
        name = request.POST['name']
        description = request.POST['description']
        ingredients = request.POST['ingredients']
        # 创建新菜品
        recipe = Recipe(name=name, description=description, ingredients=ingredients)
        recipe.save()
        return redirect('admin:list_recipes')
    return render(request, 'admin/create_recipe.html')

# 编辑菜品信息
def edit_recipe(request, recipe_id):
    recipe = get_object_or_404(Recipe, id=recipe_id)
    if request.method == 'POST':
        # 从表单获取数据
        name = request.POST['name']
        description = request.POST['description']
        ingredients = request.POST['ingredients']
        # 更新菜品信息
        recipe.name = name
        recipe.description = description
        recipe.ingredients = ingredients
        recipe.save()
        return redirect('admin:list_recipes')
    return render(request, 'admin/edit_recipe.html', {'recipe': recipe})

# 删除菜品
def delete_recipe(request, recipe_id):
    recipe = get_object_or_404(Recipe, id=recipe_id)
    if request.method == 'POST':
        # 删除菜品
        recipe.delete()
        return redirect('admin:list_recipes')
    return render(request, 'admin/delete_recipe.html', {'recipe': recipe})

六、论文参考

  • 计算机毕业设计选题推荐-智能菜谱推荐系统-论文参考:
    在这里插入图片描述

七、系统视频

智能菜谱推荐系统-项目视频:

基于Python的智能菜谱推荐系统

结语

计算机毕业设计选题推荐-智能菜谱推荐系统-Python项目实战
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:私信我

精彩专栏推荐⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT研究室

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值