A server error occurred. Please contact the administrator.痛苦!
這個(gè)錯(cuò)誤?
路由:
urlpatterns?=?[ ????path('helloworld',?blog.views.helloworld), ????path('content',?blog.views.article_content), ????path('index',?blog.views.get_index_page), ????#?path('detail',?blog.views.get_detail_page) ????path('detail/<int:article_id>',?blog.views.get_detail_page) ]
詳情頁(yè)視圖:
def?get_detail_page(request,?article_id): ????all_article?=?Article.objects.all() ????curr_article?=?None ????for?article?in?all_article: ????????if?article.article_id?==?article_id: ????????????curr_article?=?article ????????????break ????section_list?=?curr_article.content.split('\n') ????return?render(request,?'blog/detail.html', ??????????????????{ ????????????????????'curr_article':?curr_article, ????????????????????'section_list':?section_list ??????????????????} ??????????????????)
詳情頁(yè)網(wǎng)頁(yè):
<body> ????<div?class="container?page-header"> ????????<h2>{{?curr_article.title?}} ????????</h2> ????</div> ????<div?class="container?body-main"> ????????????????<div> ????????????????????{%?for?section?in?section_list?%} ????????????????????<p>{{?section?}}</p> ????????????????????{%?endfor?%} ????????????????</div> ????</div> </body>
2020-03-23
主頁(yè)中分頁(yè)設(shè)計(jì)這里,是不是也有問(wèn)題,設(shè)置<h4>這個(gè)地方??我看老師視頻里好像沒(méi)有說(shuō)這個(gè)地方?
2020-03-23
感覺(jué)是路由的問(wèn)題,<int:article_id>