Home > OS >  Attribute Error at/ 'str' object has no attribute 'makefile'
Attribute Error at/ 'str' object has no attribute 'makefile'

Time:03-27

I'm learning Django and got this error in my first code itself.

what's wrong in this code

I was trying for just Hello world type of program using Django, everything was perfect but got this error 'str' object has no attribute 'makefile'

CodePudding user response:

You are importing HTTPResponse from somewhere (http.client?) (I guess on line 1 of your script)

django.http has only HttpResponse. Try:

def home(request):
    return HttpResponse("Hello world")
  • Related