Django custom handler404 shows 404 but gives header 200

后端 未结 6 929
春和景丽
春和景丽 2020-12-15 11:58

I made a custom handler404 for a authenticated Django website to avoid information leakage.

def check_logged_in_404(request):
    \"\"\" Custom 404. Show fr         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 12:28

    I'd use render_to_string and HttpResponseNotFound, e.g. return HttpResponseNotFound(render_to_string('404.html')).

提交回复
热议问题