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 8180017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:07:33+00:00 2026-06-07T00:07:33+00:00

I have a 404.html page, but in some cases I want to be able

  • 0

I have a 404.html page, but in some cases I want to be able to send a json error message (for 404 and 500, etc.). I read the following page:

https://docs.djangoproject.com/en/dev/topics/http/views/#the-404-page-not-found-view

Is there any sort of example that shows the implementation? I have it in my urls.py but it’s not being picked up in the event of an error.

  • 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-07T00:07:35+00:00Added an answer on June 7, 2026 at 12:07 am

    This worked for me:

    from django.conf.urls import patterns, include, url
    from django.views.static import * 
    from django.conf import settings
    from django.conf.urls.defaults import handler404, handler500
    from app.views import error
    
    urlpatterns = patterns('',
        # Examples:
        # url(r'^$', 'app.views.home', name='home'),
    )
    
    handler404 = error.error_handler
    handler500 = error.error_handler
    

    You can make it do anything as you wish when going to that controller.

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

Sidebar

Related Questions

I stumbled upon Jtalk here http://nicolaspetton.github.com/jtalk/index.html#download but when clicking on download I have 404
In my .htaccess file I have: ErrorDocument 404 http://localhost/example/public_html/error/404 But when an 404 error
I have a custom error pages in my rails app testing the 404 error
For example I have site http://localhost/site In IIS I set that 404 error causes
I'm hoping somebody might be able to shed some light on this. We have
I understand that it is possible to serve a custom Error 404 page using
Not a great title but I'm looking more for some guidance, have searched quite
I want to make apache to always open up a signle page for 404
we want to build a site HABJ (*) starting from some HTML 'demo' pages
I think Im going insane, but I cannot get a simple default index.html page

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.