Phi*_*ord 5 testing django django-south
我有一个Django网站,工作正常.它在数据库中有少量数据,我想用它来进行测试.我已经完成了dumpdata来生成一些.json装置.但是,当我尝试在我的应用程序("标记器")上运行测试时,我得到一个Postgresql错误,我无法解决如何解决它:
(django-projectname)$ ./manage.py test tagger
Creating test database for alias 'default'...
Problem installing fixture '/Users/phil/Projects/RIG/projectname/django-projectname/projectname/tagger/fixtures/auth_testdata.json': Traceback (most recent call last):
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/core/management/commands/loaddata.py", line 174, in handle
obj.save(using=using)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/core/serializers/base.py", line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/db/models/base.py", line 526, in save_base
rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/db/models/query.py", line 491, in _update
return query.get_compiler(self.db).execute_sql(None)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 869, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
cursor.execute(sql, params)
File "/Users/phil/.virtualenvs/django-projectname/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
return self.cursor.execute(query, args)
IntegrityError: duplicate key value violates unique constraint "auth_permission_content_type_id_codename_key"
DETAIL: Key (content_type_id, codename)=(3, add_htuser) already exists.
Run Code Online (Sandbox Code Playgroud)
我尝试使用--natural标志为auth app做dumpdata,但这并没有改变任何东西.我很难过,无法解决从哪里获得重复密钥.
它引用的"htuser"类是auth User类上的代理模型.
我正在使用South进行应用程序的迁移,听起来像/sf/answers/202224151/可能是答案,但我不明白如何"从中删除显式设置的主键值数据游戏"?
归档时间: |
|
查看次数: |
1301 次 |
最近记录: |