环境:centos6 python2.7.14 django1.11
django教程1.11第三章:
现在让我们更新polls/views.py中的index视图来使用模板:
polls/views.py
from django.http import HttpResponse
from django.template import loader
from .models import Question
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
context = {
'latest_question_list': la