django2版本的include怎么用呢?

这是项目blog里面的url.py

from django.urls import pathfrom . import views
urlpatterns = [    path('', views.index, name="index"),
]

这是根目录里面的url.py

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('blog/', include('blog.urls')),
    path('admin/', admin.site.urls),
]

下面是报错信息

https://img1.mukewang.com/5b51f7ac0001c32606510385.jpg

白板的微信
浏览 1472回答 3
3回答

慕婉清6462132

用法没错,我估计你是忘记修改INSTALLED_APPS了

茅侃侃

from django.contrib import adminfrom django.urls import include, pathmaybe the path should be:from django.conf.urls import include,urlhave a try, Good luck.
打开App,查看更多内容
随时随地看视频慕课网APP