django入门与实践 - 关于升级到django 3.7,三种模板超链接配置
作者:互联网
1 from django.contrib import admin 2 from django.urls import path, include 3 4 urlpatterns = [ 5 path('admin/', admin.site.urls), 6 path('blog1/', include(('blog1.urls', 'a'), namespace='blogg')), #'a'可以为任意字符,但不能为空 7 ]
blog/urls.py:
1 from django.contrib import admin 2 from django.urls import path, include 3 4 urlpatterns = [ 5 path('admin/', admin.site.urls), 6 path('blog1/', include(('blog1.urls', 'a'), namespace='blogg')),#'a'可以使用任意字符,但不能为空 7 ]myblog/urls.py:
1 from django.urls import path 2 from . import views 3 urlpatterns = [ 4 path('', views.index), # 这是路由模式 5 path('article/<int:article_id>', views.article_page, name='article_detai'), # path中的组名必须和参数名一致 6 ]
标签:admin,django,3.7,blog1,超链接,urls,path,import 来源: https://www.cnblogs.com/chenjianfeng/p/10579815.html