簡體   English   中英

我有 urls.py 模式錯誤

[英]I am having urls.py patterns errors

from django.urls import path
from django.urls import include
from . import views

urlpatterns=[
 path("",views.index,name="index")
]

我有views.py如下

    from django.shortcuts import render
from . models import ClientServiceRepresentative
# Create your views here.


def index(request):
    return render(request,"ClientServicesManagement/index.html",{"representatives":ClientServiceRepresentative.objects.all()})

當我運行應用程序時,我收到以下錯誤

    File "C:\Users\hp\KHSystem\KHSystems\ClientServicesManagement\urls.py", line 6, in <module>
    path("",views.index,name="index")
AttributeError: module 'ClientServicesManagement.views' has no attribute 'index'

我已經在視圖中明確定義了索引為什么我會遇到這個問題

我認為這只是之后失蹤的Komma

 path(...), 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM