[Fixed]-Cannot import name HttpResponse

40👍

You can try this: from django.http import HttpResponse

9👍

You are importing from wrong location

django.http this is right location from django.http import HttpResponse

👤Shashi

0👍

Changing from django to django.http in the views.py file works in most cases, if it doesn’t check the urls.py file in the project dir and make sure that :

  1. the path() to your view is imported correctly
  2. that it is above the path(‘admin/’, admin.site.urls) in the urlpatterns list

Leave a comment