我正在用Django编写博客,单击地址http://localhost:8000/blog/2019/7/28/prim-algorithm-path时出现错误404
没有帖子匹配给定的查询。提出者:blog.views.blog_detail
views.py
def blog_detail(request,year,month,day,post):
print(year,month,day,post)
post = get_object_or_404(Post, slug=post, publish__year=year, publish__month=month,publish__day=day)
return render(request,'post.html',locals())
blog / urls.py
from django.urls import path
from .views import index,blog_detail
app_name = 'blog'
urlpatterns = [
path('', index, name='index'),
path('<int:year>/<int:month>/<int:day>/<slug:post>',blog_detail,name='post_detail'),
]
mysite / urls.py
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/',include('blog.urls',namespace='blog')),
]