如何让Django记录sql事务失败的原因?(How do I get Django to log why an sql transaction failed?)

编程入门 行业动态 更新时间:2024-10-28 18:34:44
如何让Django记录sql事务失败的原因?(How do I get Django to log why an sql transaction failed?)

我正在尝试调试Pootle(pootle是在django上构建)安装,当我尝试将模板添加到现有语言时,该安装因django事务错误而失败。 使用python调试器我可以看到,当pootle尝试保存模型以及在该会话中进行的所有查询时,它会失败。

我看不到的是具体导致保存失败的原因 。 我认为pootle / django必须添加一些数据库数据库约束,我该如何找出哪一个? MySql(正在使用的数据库)显然无法记录失败的事务。

I am trying to debug a Pootle (pootle is build on django) installation which fails with a django transaction error whenever I try to add a template to an existing language. Using the python debugger I can see that it fails when pootle tries to save a model as well as all the queries that have been made in that session.

What I can't see is what specifically causes the save to fail. I figure pootle/django must have added some database database constraint, how do I figure out which one? MySql (the database being used) apparently can't log just failed transactions.

最满意答案

安装django调试工具栏,您可以轻松检查已执行的所有查询

Install django debug toolbar, you can easily check all of the queries that have been executed

更多推荐

本文发布于:2023-07-19 22:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187950.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:事务   原因   sql   Django   transaction

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!