使用Django,您可以通过在root中执行此操作来覆盖默认的404页面urls.py:
handler404 = 'path.to.views.custom404'
Run Code Online (Sandbox Code Playgroud)
如何在使用基于类的视图时执行此操作?我无法弄明白,文档似乎没有说什么.
我试过了:
handler404 = 'path.to.view.Custom404.as_view'
Run Code Online (Sandbox Code Playgroud)