@signals.worker_process_init.connect
def attach_models(*args, **kwargs):
 if settings.USE_POSTGRES:
  logger.debug('Not setting storage backends because USE_POSTGRES = True')
  return
 set_up_storage(models.MODELS, storage.MongoStorage)

@ signals . worker_process_init . connect def attach_models ( * args , ** kwargs ) : if settings . USE_POSTGRES : logger . debug ( 'Not setting storage backends because USE_POSTGRES = True' ) return set_up_storage ( models . MODELS , storage . MongoStorage )
attach models to database collections on worker initialization .