[Django]name 'HttpResponse' is not defined

在跟着虫师的书一步一步的做的时候,出现了以下的问题:

[Django]name 'HttpResponse' is not defined

 

 “HttpResponse” is not defined , so i need to modify the views.py in sign folder as bellow:

from django.shortcuts import render
from django.http import HttpResponse

# Create your views here.

def index(request):
        return HttpResponse("hello Djando!")

then execute again ,python3 manage.py runserver

[Django]name 'HttpResponse' is not defined

 

上一篇:vscode electron error (Refused to execute inline event handler because it violates the following Con


下一篇:微信小程序promise async出现regeneratorRuntime is not defined错误