我们最近升级到Django的1.10,我们正在直播的网站上获取此错误:Django的自定义404处理器
内建的:类型错误custom_404()得到了一个意想不到的关键字参数“例外”
的代码如下:
urls.py
urlpatterns = [ ... ]
handler404 = global_views.custom_404
handler500 = global_views.custom_500
global_views.py
def custom_404(request, exception, template_name='404.html'):
return page_not_found(request, exception, template_name=template_name)
def custom_500(request, template_name='500.html'):
return server_error(request, template_name=template_name)
我们已经尝试了这个视图的许多变体,但都导致了这个错误。
怎么回事?
服务器已更新并重新启动数次。问题显示在我们的软件分析工具(NewRelic)上。我认为这不是客户遇到的问题,只是后端发生的事情。只需要知道是什么触发它! – zubhav
我不能重现你的错误,你有没有尝试通过在url.py中添加'url(r'^ test404 /',global_views.custom_404)'来直接测试函数? –