django,debug = True - >实际数据库错误未显示但当前事务已中止

时间:2013-10-23 14:12:35

标签: python django

用django 1.5.4:

当我在settings.py中使用DEBUG=False时,我的“真正的”数据库错误会显示在控制台输出中,例如我刚刚得到的示例:

DatabaseError: column "civility" of relation "customer_customer" does not exist
LINE 1: INSERT INTO "customer_customer" ("site_id", "civility", "las...

但是,当我在开发时,我使用DEBUG = True但是上面的错误没有显示无处而是一个非常有用的错误:

InternalError at /xxx
current transaction is aborted, commands ignored until end of transaction block

不能“正常”错误“正常”传播DEBUG = True(我顺便使用debug_toolbar)??

thx任何建议。

---已解决:

好的,我找到了可能很好的修复方法。我在我的DATABASES配置中添加了'OPTIONS':{'autocommit':True,}。现在,错误显示在控制台上,是否激活了DEBUG。现在我必须考虑这个自动提交是否是我想要的......我想是的。

1 个答案:

答案 0 :(得分:0)

好的,我找到了可能很好的修复方法。我在我的DATABASES配置中添加了'OPTIONS':{'autocommit':True,}。现在,错误显示在控制台上,是否激活了DEBUG。 现在我必须考虑这个自动提交是否是我想要的......我想是的。