Django — ‘NoneType’ object has no attribute ‘status_code’

My cache middleware was complaining about this – I thought I had a bug in another middleware that was not returning a response due to exceptions, but it was more simple: look for recent changes in your code that have altered view responses.

In my case I had added a method_decorator(cache_page) decorator to a class based view, which required I subclass the dispatch() line. Apparently, I forgot to return the super() call.

Make sure your views are returning responses!

Leave a Comment