2014-09-18 4 views
0

어떤 패턴이 같은 클라이언트에 의해 요청 된 URL, 뭔가 일치하지 않을 때 장고의 URL에 대한 방법이이 유발 될 수 있나요 !장고의 기본/오류 URL

답변

0

당신은 당신의 TEMPLATE_DIRS 경로

0

안쪽으로 404.html

파일을 생성해야합니다 예, 당신은 장고 붙박이 또는 사용자 정의 핸들러와 함께 할. urls.py

from app.error_view import my_custom_404_view #app is actually your app name 

handler404 = my_custom_404_view 

에서와 error_view.py에

는 방법 my_custom_404_view 정의

> def my_custom_404_view(request, template_name='404.html'): 
>  url_path = request.path_info 
>  if not url_path.endswith('/'): 
>   url_path = url_path + '/' 
>   return http.HttpResponseRedirect(url_path) # its just a example , you can edit whatever you want too. :)