Django — AttributeError: ‘Http404’ object has no attribute ‘status_code’

If you get this error, it might be because you are returning Http404 instead of raise ing it.

You must raise django.http.Http404, not return it.

That’s all!

6 Comments

  1. Chris Ovenden says:

    Exactly right. Cheers!

  2. David says:

    i’m facepalming, thank you!

  3. Thanks for this…your website came up in an exact Google search of the error message. Facepalm indeed ๐Ÿ™‚

    1. Yuji says:

      Facepalm!

      Thanks for the comment Michael, I ended up reading through every post on your blog.. what an awesome combination of topics.

      You absolutely need a subscribe by email!

  4. jobcello says:

    Perfect.

  5. Alir3z4 says:

    oh after 3 years, still i love it ๐Ÿ˜€

Leave a reply to Michael Halls-Moore Cancel reply