python-3.x 我尝试在pycharm上运行manage.py runserver,返回属性错误

8ehkhllq  于 4个月前  发布在  Python
关注(0)|答案(3)|浏览(56)

文件“C:\Users\user\PycharmProjects\Diabetes Prediction\Diabetes_prediction\Diabetes_Prediction\urls.py”,第23行,路径(“",views.home),^^ AttributeError:模块”Diabetes_Prediction.views“没有属性”home“
我希望这个项目能顺利进行

fafcakar

fafcakar1#

这通常意味着在视图模块中没有“home”函数或类。
要解决这个问题,你应该检查Diabetes_Prediction/views.py文件,并确保它包含一个名为'home'的函数或类。下面是views.py的一般示例:

# Diabetes_Prediction/views.py

from django.shortcuts import render

def home(request):
    # Your view logic goes here
    return render(request, 'home.html')  # Adjust the template name as needed

字符串
希望它能帮到你。

nhhxz33t

nhhxz33t2#

检查Diabetes_Prediction中的views.py文件,确定定义了home类,并检查 urls.py路径是否正确,如果www.example.com中没有home类,则创建它views.py

vsnjm48y

vsnjm48y3#

您在view.py文件中没有Home方法或类,请正确检查

相关问题