Style 500 page
This commit is contained in:
parent
0a136496f4
commit
0711288197
3 changed files with 31 additions and 1 deletions
|
@ -4,9 +4,27 @@
|
|||
<meta charset="utf-8" />
|
||||
<title>Internal server error</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style>
|
||||
html, body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
font-family: sans-serif;
|
||||
background-color: #e85537;
|
||||
color: white;
|
||||
}
|
||||
|
||||
a, a:hover {
|
||||
color: inherit;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Internal server error</h1>
|
||||
<h2>Sorry, there seems to be an error. Please try again soon.</h2>
|
||||
<p>You found a bug in my code - how dare you!</p>
|
||||
<p><a href="javascript:history.back()">Return to safety →</a></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -26,6 +26,16 @@ class Error404PageTestCase(TestCase):
|
|||
self.client.get(self.url)
|
||||
|
||||
|
||||
class Error500PageTestCase(SimpleTestCase):
|
||||
url = reverse("500")
|
||||
|
||||
def test_accessible(self) -> None:
|
||||
response = self.client.get(self.url)
|
||||
self.assertContains(
|
||||
response, "<h1>Internal server error</h1>", html=True, status_code=500
|
||||
)
|
||||
|
||||
|
||||
class RobotsViewTestCase(SimpleTestCase):
|
||||
url = reverse("robotstxt")
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import re
|
|||
from django.conf import settings
|
||||
from django.urls import include, path, re_path
|
||||
from django.views.decorators.cache import cache_control, cache_page
|
||||
from django.views.defaults import server_error
|
||||
from django.views.static import serve
|
||||
from wagtail import urls as wagtail_urls
|
||||
from wagtail.admin import urls as wagtailadmin_urls
|
||||
|
@ -40,6 +41,7 @@ urlpatterns = [
|
|||
name="keybase",
|
||||
),
|
||||
path("404/", page_not_found, name="404"),
|
||||
path("500/", server_error, name="500"),
|
||||
path("feed/", AllPagesFeed(), name="feed"),
|
||||
path(".health/", include("health_check.urls")),
|
||||
path("", include("website.legacy.urls")),
|
||||
|
|
Loading…
Reference in a new issue