Lazily fetch the django_evolution app.

Review Request #11875 — Created Nov. 16, 2021 and submitted

Information

Django Evolution
release-2.x

Reviewers

After a syncdb or migrate, django_evolution.management attempts to
record new state in the database, but it only does so once the
django_evolution app and its tables have been made available in the
database. For this, it needs a reference to the app, which was being
done at module initialization.

It's possible for this code to run too early, before other apps are
properly set up, which could cause failures either fetching the app or
from some logic within the app.

To avoid this, we now lazily fetch the app the first time we need it,
caching it for future reference.

Unit tests pass.

Successfully created new databases and upgraded existing ones.

Summary ID
Lazily fetch the django_evolution app.
After a `syncdb` or `migrate`, `django_evolution.management` attempts to record new state in the database, but it only does so once the `django_evolution` app and its tables have been made available in the database. For this, it needs a reference to the app, which was being done at module initialization. It's possible for this code to run too early, before other apps are properly set up, which could cause failures either fetching the app or from some logic within the app. To avoid this, we now lazily fetch the app the first time we need it, caching it for future reference.
aea3bac002b09bc4720fd70e515f26b6bc05c677
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.x (751acfa)