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>
--
Ticket URL: <https://code.djangoproject.com/ticket/30521>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* ui_ux: 1 => 0
* version: 2.2 => master
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. I'm not sure if we should complicate all default
error pages. It is [https://docs.djangoproject.com/en/stable/ref/views
/#error-views 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
[https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-
error-views customize error views]. To sum up default error pages are just
a fallback, but OK we can accept this as a simple cleanup.
--
Ticket URL: <https://code.djangoproject.com/ticket/30521#comment:1>
* owner: (none) => Alexandre Varas
* status: new => assigned
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/30521#comment:2>
* has_patch: 0 => 1
Comment:
Here's my patch [https://github.com/django/django/pull/11446 PR]. It adds
html to the response of all default error pages. Any comments?
--
Ticket URL: <https://code.djangoproject.com/ticket/30521#comment:3>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"3fb0a1a67f0ca3e03db59a876f87e8d0828872c4" 3fb0a1a6]:
{{{
#!CommitTicketReference repository=""
revision="3fb0a1a67f0ca3e03db59a876f87e8d0828872c4"
Refs #30521 -- Added tests for content of default error pages.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30521#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"c498f088c584ec3aff97409fdc11b39b28240de9" c498f088]:
{{{
#!CommitTicketReference repository=""
revision="c498f088c584ec3aff97409fdc11b39b28240de9"
Fixed #30521 -- Fixed invalid HTML in default error pages.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30521#comment:5>