运行python manage.py test myapp2
时,出现此错误:
Creating test database for alias 'default'...
Problem installing fixture '... project folder .../mymainapp/fixtures/initial_data.yaml': Traceback (most recent call last):
File "... project folder .../venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 196, in handle
obj.save(using=using)
File "... project folder .../venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
File "... project folder .../venv/lib/python2.7/site-packages/django/db/models/base.py", line 524, in save_base
manager.using(using).filter(pk=pk_val).exists())):
File "... project folder .../venv/lib/python2.7/site-packages/django/db/models/query.py", line 565, in exists
return self.query.has_results(using=self.db)
File "... project folder .../venv/lib/python2.7/site-packages/django/db/models/sql/query.py", line 441, in has_results
return bool(compiler.execute_sql(SINGLE))
File "... project folder .../venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
cursor.execute(sql, params)
File "... project folder .../venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
return self.cursor.execute(query, args)
DatabaseError: Could not load myapp2.table2(pk=1): relation "myapp2_table2" does not exist
LINE 1: SELECT (1) AS "a" FROM "myapp2_table2" WHERE "myapp2...
^
然而,所有实际测试运行良好,因此看起来固定装置确实已成功安装。我还可以在运行South迁移时成功安装这些灯具。
我可以做些什么来修复此错误,即使它似乎没有影响任何内容?它似乎只是在我手工制作南迁移之后才发生的。