X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/3c5fe5b298287f92a9c6a8e485c3860db36931fd..a8e1fae76ff2277a387f403600fe31bef4b2387e:/apps/maintenancemode/views/defaults.py diff --git a/apps/maintenancemode/views/defaults.py b/apps/maintenancemode/views/defaults.py new file mode 100644 index 00000000..f0bf48fe --- /dev/null +++ b/apps/maintenancemode/views/defaults.py @@ -0,0 +1,16 @@ +from django.template import Context, loader + +from maintenancemode import http + +def temporary_unavailable(request, template_name='503.html'): + """ + Default 503 handler, which looks for the requested URL in the redirects + table, redirects if found, and displays 404 page if not redirected. + + Templates: `503.html` + Context: + request_path + The path of the requested URL (e.g., '/app/pages/bad_page/') + """ + t = loader.get_template(template_name) # You need to create a 503.html template. + return http.HttpResponseTemporaryUnavailable(t.render(Context({}))) \ No newline at end of file