django-autoload is a reuseable django app which allows for correct initialization of your django project by ensuring the loading of signal handlers or indexes before any request is being processed.



  1. Add django-autoload/autoload to settings.INSTALLED_APPS
  2. Add the autoload.middleware.AutoloadMiddleware before any other middelware
    MIDDLEWARE_CLASSES = ('autoload.middleware.AutoloadMiddleware', ) + \

How does django-autoload ensures correct initialization of my project?

django-autoload provides two mechanisms to allow for correct initializations:

  1. The autoload.middleware.AutoloadMiddleware middleware will load all from settings.INSTALLED_APPS as soon as the first request is being processed. This ensures the registration of signal handlers for example.
  2. django-autoload provides a site configuration module loading mechanism. Therefore, you have to create a site configuration module. The module name has to be specified in your settings:

Now, django-autoload will load the module before any request is being processed. An example module could look like this:

from dbindexer import autodiscover

This will ensure the registration of all database indexes specified in your project.


Some apps like django-dbindexer or nonrel-search provide an autodiscover-mechanism which tries to import index definitions from all apps in settings.INSTALLED_APPS. Since the autodiscover-mechanism is so common django-autoload provides an autodiscover function for these apps.

autodiscover will search for [module_name].py in all settings.INSTALLED_APPS and load them. django-dbindexer's autodiscover function just looks like this for example:

def autodiscover():
    from autoload import autodiscover as auto_discover