A server error occurred. Please contact the administrator.痛苦!
這個錯誤?
路由:
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) ]
詳情頁視圖:
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 ??????????????????} ??????????????????)
詳情頁網頁:
<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
主頁中分頁設計這里,是不是也有問題,設置<h4>這個地方??我看老師視頻里好像沒有說這個地方?
2020-03-23
感覺是路由的問題,<int:article_id>