我在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" …Run Code Online (Sandbox Code Playgroud)