[Fixed]-Cannot import name HttpResponse


You can try this: from django.http import HttpResponse


You are importing from wrong location

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



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