Django web开发

2018-05-10  本文已影响0人  endian

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.


image.png

箭头处多了个空格

上一篇下一篇

猜你喜欢

热点阅读