The migration that creates the initial site homepage needs to be updated to ensure that will continue working under Wagtail 2.11. If you have kept the ``home`` app from the original project layout generated by the ``wagtail start`` command, this will be ``home/migrations/0002_create_homepage.py``. Inside the ``Migration`` class, add the line ``run_before = [('wagtailcore', '0053_locale_model')]`` - for example:
This fix applies to any migration that creates page instances programmatically. If you installed Wagtail into an existing Django project by following the instructions at :doc:`../getting_started/integrating_into_django`, you most likely created the initial homepage manually, and no change is required in this case.
**Further background:** Wagtail 2.11 adds a ``locale`` field to the Page model, and since the existing migrations in your project pre-date this, they are designed to run against a version of the Page model that has no ``locale`` field. As a result, they need to run before the new migrations that have been added to ``wagtailcore`` within Wagtail 2.11. However, in the old version of the homepage migration, there is nothing to ensure that this sequence is followed. The actual order chosen is an internal implementation detail of Django, and in particular is liable to change as you continue developing your project under Wagtail 2.11 and create new migrations that depend on the current state of ``wagtailcore``. In this situation, a user installing your project on a clean database may encounter the following error when running ``manage.py migrate``::
django.db.utils.IntegrityError: NOT NULL constraint failed: wagtailcore_page.locale_id
Adding the ``run_before`` directive will ensure that the migrations run in the intended order, avoiding this error.