Django-south环形附属设施

Django-south环形附属设施,django,django-south,django-1.5,Django,Django South,Django 1.5,我在Django 1.5项目中有一个应用程序(我们称之为MyApp)。MyApp定义了一个自定义用户模型(MyUser)。该项目使用另一个引用MyUser的应用程序(AnotherApp)。MyApp引用另一个应用程序中的字段 在我的开发笔记本电脑上,一切正常。我正在尝试将我的项目部署到服务器上,当我执行迁移步骤时,MyApp由于与另一个应用程序的依赖关系而失败,而另一个应用程序由于与MyApp的依赖关系而失败(我已尝试独立迁移应用程序)。它们各自的第一次迁移都失败(0001) 有什么想法吗?这

我在Django 1.5项目中有一个应用程序(我们称之为MyApp)。MyApp定义了一个自定义用户模型(MyUser)。该项目使用另一个引用MyUser的应用程序(AnotherApp)。MyApp引用另一个应用程序中的字段

在我的开发笔记本电脑上,一切正常。我正在尝试将我的项目部署到服务器上,当我执行迁移步骤时,MyApp由于与另一个应用程序的依赖关系而失败,而另一个应用程序由于与MyApp的依赖关系而失败(我已尝试独立迁移应用程序)。它们各自的第一次迁移都失败(0001)


有什么想法吗?

这里似乎有一个真正的循环依赖关系。不过,您可以很容易地打破它:将MyApp中m2m表的创建转移到单独的迁移中。最简单的方法可能是将0001_initial.py复制到一个新名称,然后删除原始名称中m2m表的块(向前和向后!),并删除副本中的所有其他内容


副本的名称应在0001_首字母和0002_之间排序——比如0001_首字母2.py;它应该取决于(“另一个应用程序”、“0001_首字母”)——这反过来也应该取决于(“我的应用程序”、“0001_首字母”)。

完美!我在MyApp的第一次迁移中使用了needed_by,然后在MyApp的第二次迁移中使用dependent_by。这使我可以设置依赖项,而无需修改另一个应用程序(在别处开发)。这个问题有一个(已关闭的)问题()可以很好地讨论这个主题。
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