Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use Custom 404 And 500 Templates #271

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

dchukhin
Copy link
Contributor

@dchukhin dchukhin commented Jul 3, 2023

ClickUp ticket: https://app.clickup.com/t/8684yagqm

As noted in the ClickUp ticket, the site is currently not defining a template to use for 404 (or a 500) status code responses. As a result, the page for such responses looks not great.

It turns out the code actually has functions for handling 404 and 500 status-code responses, but they weren't hooked up as Django expected, and the templates (404.html and 500.html) didn't exist.
This pull request:

  • hooks up the handlers for 404 and 500 status-code responses as expected by Django
  • adds the necessary HTML templates (404.html and 500.html)

To test locally:

  • set the following in your local.py settings file:
DEBUG=False
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"

To see the 404 page:

  • visit a URL that doesn't exist
    To see the 500 page:
  • add some code that causes an error
    • for example, in apps/hip/views.py, just below the def handler404(request, *args, **argv): line, add something like 1/0, then visit a URL that doesn't exist

TODO:

  • make the templates look better
  • remove things from the 500.html template that could themselves cause a 500 error

@dchukhin dchukhin changed the title Use Custom 404 And 500 Templates WIP: Use Custom 404 And 500 Templates Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant