我收到此错误,但我做了完全相同的事情:
/courses/模块'django.http.request'处的AttributeError没有属性'META'
错误发生在:
from django.shortcuts import render
from django.http import request
from django.http import HttpResponse
from .models import Course
# Create your views here.
def course_list(response):
courses = Course.objects.all()
return render(request, 'courses/course_list.html',{'courses':courses})
# output=', '.join([str(course) for course in courses])
# return HttpResponse(output)
Run Code Online (Sandbox Code Playgroud)
但服务器根本没有显示任何问题。
Performing system checks...
System check identified no issues (0 silenced).
September 13, 2016 - 13:51:18
Django version 1.10.1, using settings 'learning_site.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Run Code Online (Sandbox Code Playgroud)