(up to 1.6)
Problem is “at some point” - sometimes deploys can fail unpredictably
#3591 bug
The following will break
Good stuff
Use cases
from django import apps
from 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)
# ...
INSTALLED_APPS = (
# ...
'blog.app.BlogApp',
# ...
)
3rd party app with i18n verbose name
from django import apps
class PonyConfig(apps.AppConfig):
name = 'ponies'
verbose_name = _('mor ponies')
# ...
INSTALLED_APPS = (
# ...
'ponies.apps.PonyConfig',
# ...
)
customise a 3rd party app
class MyPonyConfig(PonyConfig):
def ready(self):
# stuff
INSTALLED_APPS = (
# ...
'myproject.apps.MyPonyConfig',
# ...
)
Note this makes it a little tricky to work out whether a model has been loaded.