无法从页面导入视图从urls.py中导入视图]]

问题描述 投票:0回答:2
from django.contrib import admin
from django.urls import path, include
from pages import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.index, name='index'),
    path('dashboard/', include(pages.urls)),
]

我正在尝试从页面目录(在Django中是一个应用程序)导入视图,例如“从页面导入视图”,但这不起作用。

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9iaUgwTS5wbmcifQ==” alt =“ >

从django.contrib从django.urls导入路径导入管理员,包括从页面导入视图urlpatterns = [path('admin /',admin.site.urls),path('',views.index,name ='index '),路径('...

python django django-views pycharm
2个回答
2
投票

更改此行:

path('dashboard/', include(pages.urls)),

0
投票

您好,欢迎来到StackOverflow!

© www.soinside.com 2019 - 2024. All rights reserved.