model is imported • ModelBase.__new__() triggers django.db.models.loading.AppCache initialization • Reverse relations now work • Most other bits of code inspect settings.INSTALLED_APPS directly
django handles applications, not just adding a piece of admin functionality • class InstalledApps() • Overloading of app_label • Clear requirement for App.path
• Django Debug Toolbar 1.0 • “He also did an multi-day in-depth review and extended discussion as a technical reviewer of Two Scoops of Django 1.6” - Danny Roy Greenfeld
to be loaded will break (in models.py,) • Likely ugettext() - use ugettext_lazy() • Code relying on import order of models.py files may break • Code relying on “for app in INSTALLED_APPS” will break
django.db.models.signals import post_save ! class BlogApp(apps.AppConfig): name = 'blog' ! def ready(self): from .models import Post from .signals import flush_cache post_save.connect(flush_cache, sender=Post)
from ponies.apps import PonyConfig ! class MyPonyConfig(PonyConfig): name = 'ponies' def ready(self): from ponies.models import Pony from pony_util.signals import flush_cache post_save.connect(flush_cache, sender=Pony)