Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:01:51+00:00 2026-06-18T11:01:51+00:00

I am creating a custom HTTP 500 error template. Why is it Django shows

  • 0

I am creating a custom HTTP 500 error template. Why is it Django shows it when i raise an exception and not when I return HttpResponseServerError (I just get the default browser 500 error)? I find this behaviour strange…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:01:53+00:00Added an answer on June 18, 2026 at 11:01 am

    The HttpResponseServerError inherits from HttpResponse and is actually quite simple:

    class HttpResponseServerError(HttpResponse):
        status_code = 500
    

    So let’s look at the HttpResponse constructor:

    def __init__(self, content='', *args, **kwargs):
        super(HttpResponse, self).__init__(*args, **kwargs)
        # Content is a bytestring. See the `content` property methods.
        self.content = content
    

    As you can see by default content is empty.

    Now, let’s take a look at how it is called by Django itself (an excerpt from django.views.defaults):

    def server_error(request, template_name='500.html'):
        """
        500 error handler.
    
        Templates: :template:`500.html`
        Context: None
        """
        try:
            template = loader.get_template(template_name)
        except TemplateDoesNotExist:
            return http.HttpResponseServerError('<h1>Server Error (500)</h1>')
        return http.HttpResponseServerError(template.render(Context({})))
    

    As you can see when you produce a server error, the template named 500.html is used, but when you simply return HttpResponseServerError the content is empty and the browser falls back to it’s default page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating new Site Definitions using this method: http://weblogs.asp.net/paulballard/archive/2007/04/09/creating-a-custom-sharepoint-2007-portal-site-definition-using-the-portalprovisioningprovider-class.aspx and when they get created,
I'm creating custom android camera layout. I've used information from http://developer.android.com/guide/topics/media/camera.html#basics . Everithing works
I have created a custom shipping module following the below two tutorials http://techportal.inviqa.com/2011/06/09/creating-a-custom-magento-shipping-method/ http://www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module
In the context of creating a custom Microsoft.Build.Utilities.Task how do I get access to
I'm using this script http://mondaybynoon.com/2009/02/23/creating-custom-form-elements-using-jquery-selects/ to create custom css select boxes in my page.
I have seen many examples of creating a custom titlebar: http://zaman91.wordpress.com/2010/03/16/android-how-to-add-custom-title-bar/ Is there a
I tried creating custom security and policy as given here: http://download.oracle.com/docs/cd/E15523_01/relnotes.1111/e10132/owsm.htm#CIADFGGC when I run
I'm creating some custom checkboxes and what I mean by that is I'm just
I'm now creating one custom silverlight button. As I want to get the visual
I am experimenting with creating my own custom HTTP Context: CustomHttpContext : HttpContextBase {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.