这是我得到的错误:
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported.
Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.
我尝试删除 include() 函数,但仍然收到错误消息,我该怎么办?
这是代码:
这是主要的 urls.py:
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('learning_logs.urls', namespace='learning_logs')),
这是辅助 urls.py:
from django.conf.urls import url
from . import views
urlpatterns = [
# Home page
url(r'^$', views.index, name='index'),
]