receiving django post_migrate signal

前端 未结 3 1179
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 09:57

I\'m doing some kind of refactoring for my project, where I\'m relying on the django django.contrib.auth.models.Permission model. So far I define the permission

3条回答
  •  温柔的废话
    2020-12-15 10:36

    The Django docs recommend connecting the post_migrate signal in your app config's ready method. The Google groups post you link to is out of date, from before the docs were updated.

    You also need to specify the app config in your INSTALLED_APPS setting.

    INSTALLED_APPS = [
        'myapp.apps.MyAppConfig',
        # ...
    ]
    

    Another way to configure your app is to use default_app_config in __init__.py of your app. See Configuring Applications. But the other way (dotted path to AppConfig) is preferred.

提交回复
热议问题