Django south circular dependency -


i have app (let's call myapp) in django 1.5 project. myapp defines custom user model (myuser). project uses app (anotherapp) references myuser. myapp references fields in anotherapp.

everything has been working fine on development laptop. i'm attempting deploy project on server, , when come migrate step, myapp fails due dependency anotherapp, , anotherapp fails on dependency myapp (i have tried migrating apps independently). both failing on respective first migrations (0001)

running migrations myapp:  - migrating forwards 0017_auto__blah_blah.  > myapp:0001_initial fatal error - 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 deferred; error was: relation "anotherapp_othermodel" not exist  error in migration: myapp:0001_initial databaseerror: relation "anotherapp_othermodel" not exist   running migrations anotherapp:  - migrating forwards 0008_blah_blah.  > anotherapp:0001_initial fatal error - following sql query failed: alter table "anotherapp_othermodel" add constraint "creator_id_refs_id_cff6fecf" foreign key ("creator_id") references "myuser" ("id") deferrable deferred; error was: relation "myuser" not exist  error in migration: anotherapp:0001_initial databaseerror: relation "myuser" not exist 

any ideas?

there appears real circular dependency here. can break quite easily, though: move creation of m2m table in myapp separate migration. easiest way so, probably, copy 0001_initial.py new name, remove blocks m2m table (forwards , backwards!) in original, , remove else in copy.

the copy should named ordered between 0001_initial , 0002_whatever -- say, 0001_initial2.py; , should depend on ("anotherapp", "0001_initial") -- which, in turn, should depend on ("myapp", "0001_initial").


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -