【发布时间】:2013-07-16 16:45:34
【问题描述】:
我在 Django 1.5 项目中有一个应用程序(我们称之为 MyApp)。 MyApp 定义了一个自定义用户模型 (MyUser)。该项目使用另一个引用 MyUser 的应用程序 (AnotherApp)。 MyApp 引用了 AnotherApp 中的字段。
在我的开发笔记本电脑上一切正常。我正在尝试将我的项目部署在服务器上,当我进入迁移步骤时,MyApp 由于对 AnotherApp 的依赖而失败,而 AnotherApp 由于对 MyApp 的依赖而失败(我已尝试独立迁移应用程序)。两者都在各自的第一次迁移中失败 (0001)
Running migrations for myapp:
- Migrating forwards to 0017_auto__blah_blah.
> myapp:0001_initial
FATAL ERROR - The following SQL query failed: ALTER TABLE "myapp_mymodel_othermodel" ADD CONSTRAINT "othermodel_id_refs_id_ae052c6d" FOREIGN KEY ("othermodel_id") REFERENCES "anotherapp_othermodel" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: relation "anotherapp_othermodel" does not exist
Error in migration: myapp:0001_initial
DatabaseError: relation "anotherapp_othermodel" does not exist
Running migrations for anotherapp:
- Migrating forwards to 0008_blah_blah.
> anotherapp:0001_initial
FATAL ERROR - The following SQL query failed: ALTER TABLE "anotherapp_othermodel" ADD CONSTRAINT "creator_id_refs_id_cff6fecf" FOREIGN KEY ("creator_id") REFERENCES "myuser" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: relation "myuser" does not exist
Error in migration: anotherapp:0001_initial
DatabaseError: relation "myuser" does not exist
有什么想法吗?
【问题讨论】:
-
这个问题有一个(关闭的)票证 (south.aeracode.org/ticket/390) 很好地讨论了这个话题。
标签: django django-south django-1.5