httpresponse django code example

Example 1: httpresponse django

from django.http import HttpResponse

Example 2: django httpresponseredirect

from django.http import HttpResponseRedirect

Example 3: set http response content type django

reponse = HttpResponse(content)
response['Content-Type'] = 'application/json' # or application/text, etc.

# one-line usage
reponse = HttpResponse(content, content_type:'application/json')

Example 4: django return httpresponse

from django.http import HttpResponse
return HttpResponse('<h1>Hello World</h1>')

Example 5: httpresponse django

from django.http import HttpResponse