8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Add custom Error 500 page

This commit is contained in:
Maël Kervella 2018-04-15 17:05:27 +00:00
parent 6c6422aff3
commit 1225af69bd
4 changed files with 63 additions and 0 deletions

View file

@ -48,6 +48,8 @@ from django.contrib.auth import views as auth_views
from .views import index, about_page from .views import index, about_page
handler500 = 're2o.views.handler500'
urlpatterns = [ urlpatterns = [
url(r'^$', index, name='index'), url(r'^$', index, name='index'),
url(r'^about/$', about_page, name='about'), url(r'^about/$', about_page, name='about'),

View file

@ -209,3 +209,8 @@ def about_page(request):
'dependencies': dependencies 'dependencies': dependencies
} }
) )
def handler500(request):
"""The handler view for a 500 error"""
return render(request, 'errors/500.html')

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

56
templates/errors/500.html Normal file
View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Re2o : Internal Server Error</title>
<style>
body {
padding: 0 1cm;
}
p {
padding: 0 2cm;
}
img {
width: 50%;
margin: 0 auto;
display: block;
}
a.button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
text-decoration: none;
color: initial;
}
</style>
</head>
<body>
<h1>Error 500 : Internal Server Error</h1>
<hr>
<p>
Congratulations !! You have discovered a bug on Re2o and you've reached a page we try
to hide, you can be proud of youself. We try to track those bugs down but apparently
we have missed one. We sincerely thank you for the help : it is not that easy to catch
them all.
</p>
<p>
<b>An email has been automatically sent to the site administrators. Please avoid
spamming them by trigerring the same issue multiple times.</b> The mail should
contains all the details necessary to understand what went wrong but if your help was
needed, you will probably be contacted by them.
</p>
<p>
This issue will be fixed as soon as possible but please take into consideration the
administrators may not be always available. If your request is really urgent, inform
your local organization, they will help you temporarily fix the issue.
<p>
<p>
<img src="/static/images/500_hackerman.jpg" alt="Error 500 Funny Image" />
</p>
<p>
If you have no idea what you've done :
<a href="/" class="button">Go back to a safe page</a>
</p>
</body>
</html>