When creating the blog hyperlink, django error: without providing an app_name is not supported Set the app_name attribute in t.

Error message:

without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple con

Specific code as follows:

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


urlpatterns = [
    url('admin/', admin.site.urls),
    url('blog/',include('blog.urls')),
    url('blog2/',include('blog2.urls',namespace='blog2'))
]

include function comprising two parameters, the first one is Arg, a second namespace, arg should be a binary tuple, but only to a code blog2.urls, so the code pattern read as follows:

url('blog2/',include(('blog2.urls','blog2'),namespace = 'blog2'))

Then again runserver, normal operation

Released three original articles · won praise 0 · Views 33

Guess you like

Origin blog.csdn.net/G36320/article/details/104901124