From 0fab4cdd9379f9d8179f2521f243badce6500420 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Wed, 18 Jul 2012 14:55:12 -0400 Subject: [PATCH] Added a method to render 404 and 500 pages. Added a reference to these views in urls.py. --- lms/djangoapps/static_template_view/views.py | 5 +++++ lms/templates/static_templates/404.html | 1 - lms/templates/static_templates/server-error.html | 2 +- lms/urls.py | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/static_template_view/views.py b/lms/djangoapps/static_template_view/views.py index 5161532bb6..0b28fb4920 100644 --- a/lms/djangoapps/static_template_view/views.py +++ b/lms/djangoapps/static_template_view/views.py @@ -40,7 +40,12 @@ def render(request, template): url(r'^jobs$', 'static_template_view.views.render', {'template': 'jobs.html'}, name="jobs") """ return render_to_response('static_templates/' + template, {}) + +def render_404(request): + return render_to_response('static_templates/404.html', {}) +def render_500(request): + return render_to_response('static_templates/server-error.html', {}) valid_auth_templates=[] diff --git a/lms/templates/static_templates/404.html b/lms/templates/static_templates/404.html index 857798a16b..4b130b43e9 100644 --- a/lms/templates/static_templates/404.html +++ b/lms/templates/static_templates/404.html @@ -1,4 +1,3 @@ - <%inherit file="../main.html" />
diff --git a/lms/templates/static_templates/server-error.html b/lms/templates/static_templates/server-error.html index be450eadff..fd00f0d734 100644 --- a/lms/templates/static_templates/server-error.html +++ b/lms/templates/static_templates/server-error.html @@ -1,6 +1,6 @@ <%inherit file="../main.html" />
-

There has been an error on the edX servers

+

There has been a 500 error on the edX servers

Our staff is currently working to get the site back up as soon as possible. Please email us at technical@mitx.mit.edu to report any problems or downtime.

diff --git a/lms/urls.py b/lms/urls.py index 39250c9e14..abad9116bc 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -162,3 +162,9 @@ urlpatterns = patterns(*urlpatterns) if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + + +#Custom error pages +handler404 = 'static_template_view.views.render_404' +handler500 = 'static_template_view.views.render_500' +