How do I use the django2 version of include?

this is the url.py in the project blog

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

this is the url.py in the root directory

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

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

the following is the error message

Mar.02,2021
The usage of

is right. I guess you forgot to modify INSTALLED_APPS


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

maybe the path should be:
from django.conf.urls import include,url

have a try, Good luck.


check to see if you have added your own app to INSTALLED_APPS


change the name of the blog folder under url.py to urls.py

Menu