[Django]-How to solve "table "auth_permission" already exists" error when the database is shared among two Django projects

2๐Ÿ‘

โœ…

Django 1.8.15 for project_2/. Iโ€™ve just checked project_1/ django version and it is 1.6. I was convinced that both projects where using the same django version.. Is this the main problem?

Yes. Because django 1.6 and django 1.8 use different syncdb commands. syncdb in 1.8 is migrate, so when you do syncdb in 1.8 you are applying migrations, not just creating tables. Use same django version and problem should be solved.

3๐Ÿ‘

You can open the migrations file and comment out the SQL that tries to create the table.
Then run migrations again.

(another possibility would be to delete the table in the database, but youโ€™d lose the data in the table.)

1๐Ÿ‘

If you use django version >1.7 you should use migrations (Django Migrations โ€“ make sure to check version matches yours)
Then you can make migrations more consistently (no conflicts). Even if they happen (but under very specific conditions), you can always โ€˜โ€“fakeโ€™ migrations on second host

Leave a comment