custom error 500
This commit is contained in:
parent
6f93a6eb94
commit
654b293769
|
@ -1,6 +1,8 @@
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url, handler500
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'', include('orchestra.urls')),
|
url(r'', include('orchestra.urls')),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
handler500 = 'orchestra.views.error_500'
|
||||||
|
|
34
orchestra/templates/error_500.html
Normal file
34
orchestra/templates/error_500.html
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>500 Internal Server Error</title>
|
||||||
|
<style>
|
||||||
|
/* Your custom CSS styles go here */
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f3f3f3;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
padding: 100px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 48px;
|
||||||
|
color: #ff5733;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>Oops! Something Went Wrong</h1>
|
||||||
|
<p>The error to the technicians is sent, so that they review it as soon as possible.</p>
|
||||||
|
<p>If the problem persists, you can communicate with our support team at support@pangea.org.</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -9,11 +9,9 @@ from . import api
|
||||||
from .utils.apps import isinstalled
|
from .utils.apps import isinstalled
|
||||||
from orchestra.contrib.metrics.views import metrics_view
|
from orchestra.contrib.metrics.views import metrics_view
|
||||||
|
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
api.autodiscover()
|
api.autodiscover()
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# Admin
|
# Admin
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
|
@ -31,7 +29,6 @@ urlpatterns = [
|
||||||
|
|
||||||
# MUSICIAN
|
# MUSICIAN
|
||||||
path('panel/', include('orchestra.contrib.musician.urls')),
|
path('panel/', include('orchestra.contrib.musician.urls')),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,9 @@ from django.apps import apps
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.contrib.admin.utils import unquote
|
from django.contrib.admin.utils import unquote
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404, render
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
|
||||||
|
|
||||||
def serve_private_media(request, app_label, model_name, field_name, object_id, filename):
|
def serve_private_media(request, app_label, model_name, field_name, object_id, filename):
|
||||||
model = apps.get_model(app_label, model_name)
|
model = apps.get_model(app_label, model_name)
|
||||||
if model is None:
|
if model is None:
|
||||||
|
@ -18,3 +17,7 @@ def serve_private_media(request, app_label, model_name, field_name, object_id, f
|
||||||
return serve(request, field.name, document_root=field.storage.location)
|
return serve(request, field.name, document_root=field.storage.location)
|
||||||
else:
|
else:
|
||||||
raise PermissionDenied()
|
raise PermissionDenied()
|
||||||
|
|
||||||
|
|
||||||
|
def error_500(request):
|
||||||
|
return render(request, 'error_500.html', {}, status=500)
|
Loading…
Reference in a new issue