[Django]-Wagtail: Locale_ID cannot be null

6👍

You need to add the following line to the 0002_create_homepage.py migration file, inside class Migration:

run_before = [
    ('wagtailcore', '0053_locale_model'),
]

This change is necessary as a result of the new multi-language implementation in Wagtail 2.11. More details are here: https://docs.wagtail.io/en/stable/releases/2.11.html#run-before-declaration-needed-in-initial-homepage-migration

If you’ve already run ./manage.py migrate without this new line in place and received the locale_id IntegrityError, you’ll need to drop and recreate the database and then re-run ./manage.py migrate, as the previous failure will have left the database in an inconsistent state. (Dropping and recreating the database will delete any existing data, but as this issue will only arise on a new deployment on a clean database anyway, that shouldn’t be an issue.)

👤gasman

Leave a comment