错误django-urls

问题描述 投票:1回答:1
from django.urls import path, re_path
from . import views
app_name="home-app"

urlpatterns = [
   path('nueva-url', IndexView.views(), name='index')#this synthesis does not work, it gives me an error.
]

我的IDE在IndexView下面画了一条红线:enter image description here

django python-3.x django-urls
1个回答
2
投票

更改您的import语句:

from .views import IndexView

urlpatterns = [ 
    path('nueva-url', IndexView.as_view(), name='index')
]
© www.soinside.com 2019 - 2024. All rights reserved.