无法导入名称HttpResponse

fuh*_*715 6 python django

views.py

from django import HttpResponse

def hello(request):
    return HttpResponse("Hello world ! ")
Run Code Online (Sandbox Code Playgroud)
Request Method: GET
Request URL:    http://127.0.0.1:8000/hello/
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:    
cannot import name HttpResponse

jua*_*ith 24

你可以试试这个: from django.http import HttpResponse


Sha*_*shi 6

您从错误的位置导入

django.http这是正确的位置from django.http import HttpResponse