Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django post_syncdb signal handler not getting called?

I have a myapp/management/__init__.py that is registering a post_syncdb handler like so:

from django.db.models import signals
from features import models as features

def create_features(app, created_models, verbosity, **kwargs):
    print "Creating features!"
    # Do stuff...

signals.post_syncdb.connect(create_features, sender=features)

I've verified the following:

  1. Both features and myapp are in settings.INSTALLED_APPS
  2. myapp.management is getting loaded prior to the syncdb running (verified via a print statement at the module level)
  3. The features app is getting processed by syncdb, and it is emitting a post_syncdb signal (verified by examining syncdb's output with --verbosity=2.
  4. I'm using the exact same idiom for another pair of apps, and that handler is called correctly. I've compared the two modules and found no relevant differences between the invocations.

However, myapp.management.create_features is never called. What am I missing?

like image 841
David Eyk Avatar asked Apr 27 '26 08:04

David Eyk


1 Answers

try putting it in your models.py

like image 159
Paulo Avatar answered Apr 29 '26 20:04

Paulo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!