.
This commit is contained in:
@@ -81,6 +81,7 @@ urlpatterns = [
|
|||||||
#handler400 = 'my_app.views.bad_request'
|
#handler400 = 'my_app.views.bad_request'
|
||||||
handler403 = 'rad.views.page_forbidden'
|
handler403 = 'rad.views.page_forbidden'
|
||||||
handler404 = 'rad.views.page_not_found'
|
handler404 = 'rad.views.page_not_found'
|
||||||
|
handler500 = 'rad.views.server_error'
|
||||||
#handler500 = 'my_app.views.server_error'
|
#handler500 = 'my_app.views.server_error'
|
||||||
|
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|||||||
@@ -368,4 +368,15 @@ def page_forbidden(request, exception):
|
|||||||
|
|
||||||
#response.status_code = 404
|
#response.status_code = 404
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
|
def server_error(request, exception):
|
||||||
|
ex = None
|
||||||
|
if request.user.is_superuser:
|
||||||
|
ex = exception
|
||||||
|
|
||||||
|
response = render(request, '500.html', {"exception": ex})
|
||||||
|
|
||||||
|
#response.status_code = 404
|
||||||
|
|
||||||
return response
|
return response
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% load static %}
|
||||||
|
<div class="">
|
||||||
|
<h2>Server Error (500)</h2>
|
||||||
|
<img src="{% static 'img/x-ray-radiation-no-unauthorised.png' %}" width="500px">
|
||||||
|
|
||||||
|
{% if exception %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user