[Django]-Overriding AppConfig.ready()

172👍

You need to do one of two things. Either explicitly say which AppConfig you want in INSTALLED_APPS:

INSTALLED_APPS = [
    'my_app.apps.MyAppConfig'
]

Or, define a default_app_config in the __init__.py of your app:

# my_app/__init__.py
default_app_config = 'my_app.apps.MyAppConfig'

(and leave INSTALLED_APPS as-is).

As it is currently Django can’t find any AppConfig for the app and just assumes there isn’t one. So your views etc. will work, but the ready() method will never get called.

Here’s the relevant section of the documentation.

Edit: as of Django 3.2, specifying a default_app_config is no longer necessary, and is in fact deprecated – so this answer is redundant for anyone using Django 3.2 or later.

Leave a comment