我尝试了此链接https://stackoverflow.com/a/42036696/6473175
,但似乎不起作用,当500
加载我的自定义404,html时,当DEBUG=False
时,出现了DEBUG=True
服务器错误页面。我一直想在下面做类似的事情。
def handler404(request):
domain = request.META['HTTP_HOST']
if domain == "mydomain1":
return render(request, 'index.html', status=404)
else:
return render(request, '404.html', status=404)