Opened 5 years ago
Closed 5 years ago
#30521 closed Cleanup/optimization (fixed)
Default error webpages are not correctly-formed html pages.
Reported by: | Ruben Garcia | Owned by: | Alexandre Varas |
---|---|---|---|
Component: | Error reporting | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The default page served for the 404 error in "DEBUG=False" mode is (django 2.2.1):
<h1>Not Found</h1><p>The requested resource was not found on this server.</p>
I would expect that by default, a full webpage is sent to the user, thus:
<html>
<body>
<h1>Not Found</h1><p>The requested resource was not found on this server.</p>
</body>
</html>
In "DEBUG=True" mode, the webpage served is correct html:
<!DOCTYPE html>
<html lang="en">
...
</html>
Change History (5)
comment:1 by , 5 years ago
Summary: | Default error webpages are not correctly-formed html pages → Default error webpages are not correctly-formed html pages. |
---|---|
Triage Stage: | Unreviewed → Accepted |
UI/UX: | unset |
Version: | 2.2 → master |
comment:2 by , 5 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
I'll start working on this ticket.
Following @felixxm comment I'll see if a *simple* solution can be applied.
My opinion is that Django should use the corresponding format or at least to be consistent with other responses.
comment:3 by , 5 years ago
Has patch: | set |
---|
Here's my patch PR. It adds html to the response of all default error pages. Any comments?
Thanks for the report. I'm not sure if we should complicate all default error pages. It is documented that by default error views produce a very simple messages and it is also still recommended as good practice to provide custom templates in order to present pretty error pages to the user. You can also customize error views. To sum up default error pages are just a fallback, but OK we can accept this as a simple cleanup.