add 404 and 500 handlers
This commit is contained in:
Родитель
12d125dc9e
Коммит
54dec974a8
|
@ -0,0 +1,40 @@
|
|||
{% extends "base_side_categories.html" %}
|
||||
|
||||
{% block title %}{{ _('Not Found') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{# TODO(jbalogh): reverse these URLs. #}
|
||||
{% trans rec="/recommended", search="/search", home="/" %}
|
||||
<h1>We’re sorry, but we can’t find what you’re looking for.</h1>
|
||||
|
||||
<p>
|
||||
The page or file you requested wasn't found on our site. It's possible that
|
||||
you clicked a link that's out of date, or typed in the address incorrectly.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>If you typed in the address, please double check the spelling.</li>
|
||||
<li>
|
||||
If you followed a link from somewhere, please let us know at
|
||||
<a href="mailto:webmaster@mozilla.com"
|
||||
title="Page Not Found on Mozilla.com">webmaster@mozilla.com</a>.
|
||||
Tell us where you came from and what you were looking for, and we'll do
|
||||
our best to fix it.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Or you can just jump over to some of the popular pages on our website.</p>
|
||||
|
||||
<ul>
|
||||
<li>Are you interested in a <a href="{{ rec }}">list of recommended add-ons</a>?</li>
|
||||
<li>
|
||||
Do you want to <a href="{{ search }}">search for add-ons</a>? You may go to the
|
||||
<a href="{{ search }}">search page</a> or just use the search field above.
|
||||
</li>
|
||||
<li>
|
||||
If you prefer to start over, just go to the
|
||||
<a href="{{ home }}">add-ons front page</a>.
|
||||
</li>
|
||||
</ul>
|
||||
{% endtrans %}
|
||||
{% endblock %}
|
|
@ -0,0 +1,15 @@
|
|||
{% extends "base_side_categories.html" %}
|
||||
|
||||
{% block title %}{{ _('Oops') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% trans home="/" %}
|
||||
<h1>Oops! We had an error.</h1>
|
||||
|
||||
<p>We'll get to fixing that soon.</p>
|
||||
<p>
|
||||
You can try refreshing the page, or head back to the
|
||||
<a href="{{ home }}">Add-ons homepage</a>.
|
||||
</p>
|
||||
{% endtrans %}
|
||||
{% endblock %}
|
|
@ -1,10 +1,11 @@
|
|||
import jingo
|
||||
import socket
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import parse_backend_uri
|
||||
from django.views.decorators.cache import never_cache
|
||||
|
||||
import jingo
|
||||
|
||||
|
||||
@never_cache
|
||||
def monitor(request):
|
||||
|
@ -41,3 +42,11 @@ def monitor(request):
|
|||
{'memcache_results': memcache_results,
|
||||
'status_summary': status_summary},
|
||||
status=status)
|
||||
|
||||
|
||||
def handler404(request):
|
||||
return jingo.render(request, 'amo/404.lhtml', status=404)
|
||||
|
||||
|
||||
def handler500(request):
|
||||
return jingo.render(request, 'amo/500.lhtml')
|
||||
|
|
3
urls.py
3
urls.py
|
@ -5,6 +5,9 @@ from django.shortcuts import redirect
|
|||
|
||||
admin.autodiscover()
|
||||
|
||||
handler404 = 'amo.views.handler404'
|
||||
handler500 = 'amo.views.handler500'
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url('^$', 'jingo.views.direct_to_template',
|
||||
{'template': 'base.html'}, name='home'),
|
||||
|
|
Загрузка…
Ссылка в новой задаче