From: Radek Czajka Date: Wed, 19 May 2010 08:31:49 +0000 (+0200) Subject: django-maintainance, 500, 503 error pages X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/7c273a0df15d034e985d0e3fad05653ae548dc54?ds=inline;hp=--cc django-maintainance, 500, 503 error pages 50?.html templates are self-contained now don't need handler500 or main views file --- 7c273a0df15d034e985d0e3fad05653ae548dc54 diff --git a/requirements.txt b/requirements.txt index 9a3e856ab..964141b27 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,7 @@ Django>=1.1.1,<1.2 South>=0.4 # migrations for django django-pagination>=1.0 django-rosetta>=0.5.3 +django-maintenancemode>=0.9 # Feedparser Feedparser>=4.1 diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index ff979a656..dcf0cc304 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -5,6 +5,7 @@ PROJECT_DIR = path.abspath(path.dirname(__file__)) DEBUG = False TEMPLATE_DEBUG = DEBUG +MAINTENANCE_MODE = False ADMINS = [ # ('Your Name', 'your_email@domain.com'), @@ -90,6 +91,8 @@ MIDDLEWARE_CLASSES = [ 'django.middleware.doc.XViewMiddleware', 'pagination.middleware.PaginationMiddleware', 'django.middleware.locale.LocaleMiddleware', + + 'maintenancemode.middleware.MaintenanceModeMiddleware', ] ROOT_URLCONF = 'wolnelektury.urls' diff --git a/wolnelektury/templates/500.html b/wolnelektury/templates/500.html index 117fbc2af..4ecf3ad3d 100644 --- a/wolnelektury/templates/500.html +++ b/wolnelektury/templates/500.html @@ -6,12 +6,51 @@ 500 - {% trans "Server error" %} WolneLektury.pl - + + - +

{% trans "Server error" %}

{% trans "

The Wolnelektury.pl site is currently unavailable. Meanwhile, visit our blog.

Inform our administrators about the error.

" %} diff --git a/wolnelektury/templates/503.html b/wolnelektury/templates/503.html new file mode 100644 index 000000000..7d444a2cc --- /dev/null +++ b/wolnelektury/templates/503.html @@ -0,0 +1,66 @@ +{% load i18n %} + + + +503 - {% trans "Service unavailable" %} WolneLektury.pl + + + + + + + + + +

{% trans "Service unavailable" %}

+

+{% trans "The Wolnelektury.pl site is currently unavailable due to maintainance." %} +

+ + + + + \ No newline at end of file diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index b576a2710..a7cd45f43 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -55,5 +55,3 @@ if 'rosetta' in settings.INSTALLED_APPS: urlpatterns += patterns('', url(r'^rosetta/', include('rosetta.urls')), ) - -handler500 = 'views.server_error' diff --git a/wolnelektury/views.py b/wolnelektury/views.py deleted file mode 100644 index be1ec9987..000000000 --- a/wolnelektury/views.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- - -from django.shortcuts import render_to_response -from django.template import RequestContext - -def server_error(request): - return render_to_response('500.html', RequestContext(request)) -