diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 259ae57..eb634b0 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -18,7 +18,8 @@ from django.core.files.temp import NamedTemporaryFile # to install PIL on MacOSX: 'easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz' from PIL import Image -from django.http import HttpResponse, Http404, HttpResponseBadRequest, HttpResponseForbidden +from django.http import HttpResponse, Http404, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseServerError +from django.http import HttpResponseNotFound from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied from django.core.context_processors import csrf @@ -1597,3 +1598,11 @@ def event(request): console logs don't get distracted :-) ''' return HttpResponse(True) + + +def render_404(request): + return HttpResponseNotFound(render_to_string('404.html', {})) + + +def render_500(request): + return HttpResponseServerError(render_to_string('500.html', {})) diff --git a/cms/templates/404.html b/cms/templates/404.html new file mode 100644 index 0000000..a45a223 --- /dev/null +++ b/cms/templates/404.html @@ -0,0 +1,14 @@ +<%inherit file="base.html" /> +<%block name="title">Page Not Found</%block> + +<%block name="content"> + +<div class="wrapper-content wrapper"> + <section class="content"> + + <h1>Page not found</h1> + <p>The page that you were looking for was not found. Go back to the <a href="/">homepage</a> or let us know about any pages that may have been moved at <a href="mailto:technical@edx.org">technical@edx.org</a>.</p> + </section> +</div> + +</%block> \ No newline at end of file diff --git a/cms/templates/500.html b/cms/templates/500.html new file mode 100644 index 0000000..2645b00 --- /dev/null +++ b/cms/templates/500.html @@ -0,0 +1,13 @@ +<%inherit file="base.html" /> +<%block name="title">Server Error</%block> + +<%block name="content"> + +<div class="wrapper-content wrapper"> + <section class="content"> + <h1>Currently the <em>edX</em> servers are down</h1> + <p>Our staff is currently working to get the site back up as soon as possible. Please email us at <a href="mailto:technical@edx.org">technical@edx.org</a> to report any problems or downtime.</p> + </section> +</div> + +</%block> \ No newline at end of file diff --git a/cms/urls.py b/cms/urls.py index d43b9bc..69ce4a5 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -104,3 +104,9 @@ if settings.ENABLE_JASMINE: urlpatterns = urlpatterns + (url(r'^_jasmine/', include('django_jasmine.urls')),) urlpatterns = patterns(*urlpatterns) + +#Custom error pages +handler404 = 'contentstore.views.render_404' +handler500 = 'contentstore.views.render_500' + +