django - “manage.py test”失败“表已经存在” [英] django - "manage.py test" fails "table already exists"

查看:213
本文介绍了django - “manage.py test”失败“表已经存在”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚到了django世界。运行一些教程应用程序,运行python manage.py测试时,我遇到失败,表示表已经存在。我不知道发生了什么。我也在运行南方,迁移模式时我没有错误。



非常感谢任何见解。



TIA
Joey

解决方案

这可能是您的一个南方迁移中的错误。您没有看到真正的数据库中的问题,因为迁移已被执行(可以使用 - 假选项)



您可以尝试从scracth重新创建数据库并且看看它是否有效。



您还可以通过在您的...中添加 SOUTH_TESTS_MIGRATE = False 来禁用南方单元测试settings.py。使用此选项,将会创建一个常规syncdb来创建测试数据库。它也将加速测试过程。



希望它有助于


I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema.

Any insight is greatly appreciated.

TIA Joey

解决方案

It might be an error in one of your south migrations. You don't see the problem on the real db because the migration has been executed (with the--fake option maybe)

You can try to recreate the db from scracth and see if it works.

You can also disable South for unit-tests by adding SOUTH_TESTS_MIGRATE = False in your settings.py. With this option a regular syncdb will be done to create the test database. It will also speed the testing process.

I hope it helps

这篇关于django - “manage.py test”失败“表已经存在”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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