def page_not_found(request, template_name='404.html'): """ 404 (page not found) handler which uses Jinja2 to render the template. The default template is ``404.html``, and its context will contain ``request_path`` (the path of the requested URL) and any additional parameters provided by the registered context processors (this view uses ``RequestContext``). """ context = RequestContext(request, {'request_path': request.path}) response = context.render_response(template_name) response.status_code = 404 return response