Как отобразить пользовательскую страницу 404.html в Django

Я хочу отобразить пользовательскую страницу ошибки 404, когда конечный пользователь вводит неправильный URL, я пытался, но я получаю только страницу Django по умолчанию 404. Я использую Python (2.7.5), Django (1.5.4)

Мой код

urls.py

from django.conf.urls import patterns, include, url
from mysite import views
handler404 = views.error404

urlpatterns = patterns('',
url(r'^

views.py

from django.http import HttpResponse
from django.shortcuts import render
from django.template import Context, loader

def home(request):
     return HttpResponse("welcome to my world")

def error404(request):
     template = loader.get_template('404.html')
     context = Context({'message': 'All: %s' % request,})
     return HttpResponse(content=template.render(context), content_type='text/html; charset=utf-8', status=404)

Я поместил свою страницу 404.html в каталог шаблонов. Как с этим справиться?

, 'mysite.views.home', name='home'), )

views.py

from django.http import HttpResponse
from django.shortcuts import render
from django.template import Context, loader

def home(request):
     return HttpResponse("welcome to my world")

def error404(request):
     template = loader.get_template('404.html')
     context = Context({'message': 'All: %s' % request,})
     return HttpResponse(content=template.render(context), content_type='text/html; charset=utf-8', status=404)

Я поместил свою страницу 404.html в каталог шаблонов. Как с этим справиться?

Ответы на вопрос(1)

Ваш ответ на вопрос