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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:56:57+00:00 2026-06-17T22:56:57+00:00

How to handle 404, 403, 500 error in django? I want to create customized

  • 0

How to handle 404, 403, 500 error in django? I want to create customized page for those errors.

  • 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-17T22:56:58+00:00Added an answer on June 17, 2026 at 10:56 pm

    First, create 404.html, 403.html and 500.html.

    For example for 403.html

    {% extends "base.html" %}
    
    {% block title %}{{block.super}}Forbidden{% endblock %}
    
    {% block content %}
    <div id="container">
    <h1>403</h1>
    <h2>Forbidden</h2>
    </div>
    {% endblock %}
    

    In your base.html:

    <html>
    <head>
        <title>{% block title %}{% endblock %}</title>
        <link rel="stylesheet" href="{{STATIC_URL}}css/style.css?v=1">
    </head>
    
    <body>
        {% block content %}{% endblock %}
    </body>
    </html>
    

    Put this in your url.py

    #handle the errors    
    from django.utils.functional import curry
    from django.views.defaults import *
    
    handler500 = curry(server_error, template_name='500.html')
    handler404 = curry(page_not_found, template_name='404.html')
    handler403 = curry(permission_denied, template_name='403.html')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want a custom error page shown for 500, 404 and 403. Here's what
How can I handle manually the 404 error in C#? I want to check
I am trying to make custom error pages for 404, 403, 5xx errors. I
I want to display 404 error page for that i have made error404.php file
I want to handle 404 error when change the domain name, here's the domain
How can I handle ALL 404 errors? If I goto a page that does
Good day! I use strategy to handle 404 errors like this: Error handling for
How can I create a route that will handle 403 errors from Express? I
What’s the preferred way to handle 404 errors with Play 2.0 and show a
I'd like to handle HTML 404 errors in my web app. I can write

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.