在django中,有没有办法捕获python脚本异常并出现在html页面中,而不是允许django提供500或页面完整的异常页面(debug = on)
try:
result = my_resolver.query(host,raise_on_no_answer=False)
for a in result:
r = r.address
except resolver.NXDOMAIN:
r = "No record found"
args = {'message':r}
return render(request, 'dns.html', args)