Django web开发

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.
正确做法是:
from django.urls import path
from learning_logs.views import index
app_name = 'learning_logs'

urlpatterns = [
#主页
path('', index, name='index'),
]

Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))

Reverse for 'topic ' not found. 'topic ' is not a valid view function or pattern name.


Django web开发_第1张图片
image.png

箭头处多了个空格

你可能感兴趣的:(Django web开发)