1.应用views.py,完成视图的定义
1 def article_content(request): 2 article = Article.objects.all()[0] 3 title = article.title 4 brief_content = article.brief_content 5 content = article.content 6 article_id = article.article_id 7 publish_date = article.publish_date 8 return_str = 'title: %s, brief_content: %s, content: %s, article_id: %s, publish_date: %s'.format(title, 9 brief_content, 10 content, 11 article_id, 12 publish_date) 13 return HttpResponse(return_str)
2.配置应用级别的路由
1 path('content', blog.views.article_content),
3.配置项目级别的路由
1 path('blog/', include('blog.urls')),