Skip to content

Commit

Permalink
Merge pull request #68 from kevwilde/22-page-not-found
Browse files Browse the repository at this point in the history
Implemented #22: Make a proper 404 page.
  • Loading branch information
meshy committed May 18, 2013
2 parents 4fa50ad + 1417a97 commit ad36be7
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 2 deletions.
28 changes: 28 additions & 0 deletions cbv/static/style.css
Expand Up @@ -117,3 +117,31 @@ footer p {
.nav .nav-header{
padding: 0 15px;
}
.http-error {
text-align: center;
margin-bottom: 3em;
}
.http-error-number {
font-size: 18em;
line-height: 1em;
margin: 0 auto;
width: 400px;
}
.http-error-message {
font-size: 2.5em;
text-align: justify;
line-height: 1.4em;
margin: 0 auto;
width: 400px;
}
@media (max-width: 480px) {
.http-error-number {
margin-top: -30px;
font-size: 9em;
width: 200px;
}
.http-error-message {
font-size: 1.5em;
width: 200px;
}
}
16 changes: 15 additions & 1 deletion cbv/templates/404.html
@@ -1 +1,15 @@
404: File not found.
{% extends "base.html" %}
{% load url from future %}

{% block content %}
<div class="span12">
<div class="http-error">
<h1 class="http-error-number">
404
</h1>
<p class="http-error-message">
The page you are looking for can't be found. Try our <a href="{% url 'home' %}">Homepage</a>.
</p>
</div>
</div>
{% endblock content %}
17 changes: 16 additions & 1 deletion cbv/templates/500.html
@@ -1 +1,16 @@
500: Server error.
{% extends "base.html" %}

{% block content %}
<div class="span12">
<div class="http-error">
<h1 class="http-error-number">
500
</h1>
<p class="http-error-message">
Oops, look like we broke something. We received a notification
and will fix it as soon as possible. In the meantime, you can
go back to our <a href="/">Homepage</a>.
</p>
</div>
</div>
{% endblock content %}
9 changes: 9 additions & 0 deletions inspector/urls.py
Expand Up @@ -2,6 +2,7 @@
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import TemplateView

from cbv.views import HomeView

Expand All @@ -17,3 +18,11 @@
)

urlpatterns += staticfiles_urlpatterns() + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
urlpatterns += patterns('',
url(r'^404/', TemplateView.as_view(template_name='404.html')),
url(r'^500/', TemplateView.as_view(template_name='500.html')),
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
)

0 comments on commit ad36be7

Please sign in to comment.