Django migration issues on pscale branch #595
-
The production branch works fine in django. However, when making a dev branch and running the server, django prompts that there are n unapplied migrations. I am unable to apply those migrations to the dev branch since the schema already exists (as intended with pscale's branching feature). I am able to run the server without the migrations, but cannot access any urls due to this error: DoesNotExist at /admin/login/ I'm unsure why django detects missing migrations since the tables/schema should be the same between the main and dev branch. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solved this after some digging: Since you cannot apply migrations to an existing schema, fake the migrations first using To resolve the site query error, you must create a site object in the sites table for the dev database. This is normally done automatically during initial migration but since that migration wasn't run, you can add a sites object manually in the shell:
Make sure you define a site_id in your settings: |
Beta Was this translation helpful? Give feedback.
Solved this after some digging:
Since you cannot apply migrations to an existing schema, fake the migrations first using
manage.py migrate --fake
. This will bring the dev db up to date with current migrations.To resolve the site query error, you must create a site object in the sites table for the dev database. This is normally done automatically during initial migration but since that migration wasn't run, you can add a sites object manually in the shell:
Make sure you define a site_id in your settings:
SITE_ID = 1