[Django]-: AttributeError: 'str' object has no attribute 'resolve' o

5👍

There is 2 definitions:

HttpResponse in django

HTTPResponse in python.

You are using the python class with the django init argument style: HTTPResponse("hello Nikhil").

So make sure you use the right import statement AND pay attention to the HTTP and Http:

from django.http import HttpResponse

Just for information

  1. Python Definition:
class HTTPResponse(io.BufferedIOBase):
    def __init__(self, sock, debuglevel=0, method=None, url=None):
  1. Django Definition:
class HttpResponse(HttpResponseBase):
    def __init__(self, content=b'', *args, **kwargs):

Leave a comment