Linux Mint上的Django和PgSQL连接问题 [英] Django and PgSQL connection issues on Linux Mint

查看:91
本文介绍了Linux Mint上的Django和PgSQL连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我从Windows 7切换到Linux Mint12。到目前为止,除了Django和PostgreSQL的一些问题之外,一切都很好。

Yesterday I switched from Windows 7 to Linux Mint 12. Everything has been fine so far except some issues with Django and PostgreSQL.

我运行一些读取文件的代码并将信息写入数据库。在Windows上,它运行顺利,没有任何异常,但是,在Linux上,我总是得到此提示:

I run some code which reads files and writes information to the database. On Windows it runs smoothly without any exceptions, however, on Linux I constantly get this:

django.db.utils.DatabaseError: current transaction is aborted, commands ignored until end of transaction block

并结束日志: http://pastebin.com/Uf1Jb3fe

脚本是通过终端调用,导入django设置,然后使用ORM,但我认为并非如此,因为在Windows中,一切都很好。

The script is called through terminal, imports django settings and then uses ORM, but I think this is not the case as in Windows everything is just fine.

那么,我该怎么办?顺便说一下,尝试以非常详细的方式解释该解决方案,因为我仍然是Linux的新手。

So, what should I do? By the way, try to explain the solution in a very detailed way as I'm still a newbie in Linux.

推荐答案

消息:当前事务被中止,命令被忽略,直到事务块结束始终是由先前的错误引起的。在这种情况下,您发布的日志中的第一个INSERT导致重复的密钥冲突。

The message: current transaction is aborted, commands ignored until end of transaction block is allways caused by a previous error. In this case the first INSERT in the log you posted caused a duplicate key violation.


2012-02-05 13:10:58 EET LOG:语句:INSERT INTO
upgrades_manastone(名称 , slug, db_id, description,
title_colour, worth, level)值('Stamina XIII',',0,',
'white ',1,13)返回 upgrades_manastone。 id

2012-02-05 13:10:58 EET LOG: statement: INSERT INTO "upgrades_manastone" ("name", "slug", "db_id", "description", "title_colour", "worth", "level") VALUES ('Stamina XIII', '', 0, '', 'white', 1, 13) RETURNING "upgrades_manastone"."id"

2012-02-05 13:10:58 EET错误:重复的键值违反了唯一约束
upgrades_manastone_slug_key

2012-02-05 13:10:58 EET ERROR: duplicate key value violates unique constraint "upgrades_manastone_slug_key"

解决重复的密钥冲突,一切都应该没事。

Resolve the duplicate key violation and everything should be fine.

这篇关于Linux Mint上的Django和PgSQL连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆