Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些自定义错误页面和视图。如何直接限制从浏览器访问此页面,因此如果用户输入地址字符串“somesite/some_error”,他将无法获取此页面。它应该只在发生一些错误时显示。
不禁止访问,就不能简单的渲染一下你想显示的错误页面吗?也就是说,而不是
render_to_result('mypage.html', {})
你现在做,做一个
render_to_result('error500.html', {'error': 'oops'})
这样您就没有明确的 url,但您确实可以将信息发送给用户。