Immutable solution version
RuntimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label when importing
Complete solution
This was a regression in django-ses v4.2.0: importing models at the top of signals.py (and utils.py, reached via django_ses.views) forced Django to resolve the SESStat model without the app being installed. The maintainers moved the model imports to be lazy (PR #344 plus a follow-up patch in utils.py), and the reporter confirmed the fix worked.
The situation:
After upgrading django-ses to v4.2.0, importing anything from djangoses.signals (e.g. `from djangoses.signals import bouncereceived, complaintreceived`) raised: RuntimeError: Model class djangoses.models.SESStat doesn't declare an explicit applabel and isn't in an application in INSTALLEDAPPS. The project deliberately did not add djangoses to INSTALLED_APPS because it did not use the SES Sending Stats feature, and adding it would trigger unwanted migrations. The regression came from the blacklist feature in v4.2.0, which imported models into signals.py (and utils.py via views), forcing the app registry to load.
What actually fixes it (verified in the thread):
This was a regression in django-ses v4.2.0: importing models at the top of signals.py (and utils.py, reached via djangoses.views) forced Django to resolve the SESStat model without the app being installed. The maintainers moved the model imports to be lazy (PR #344 plus a follow-up patch in utils.py), and the reporter confirmed the fix worked. Upgrade to django-ses v4.3.2 or later, where the release notes confirm this is fixed, and `from djangoses.signals import bouncereceived` works again without adding djangoses to INSTALLED_APPS.
Evidence
Someone asked: After upgrading django-ses to v4.2.0, importing anything from djangoses.signals (e.g. `from djangoses.signals import bouncereceived, complaintreceived) raised: RuntimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. The project deliberately did not add django_ses to INSTALLED_APPS because it did not use the SES Sending Stats feature, and adding it would trigger unwanted migrations. The regression came from the blacklist feature in v4.2.0, which imported models into signals.py (and utils.py via views), forcing the app registry to load. The verified answer: This was a regression in django-ses v4.2.0: importing models at the top of signals.py (and utils.py, reached via django_ses.views) forced Django to resolve the SESStat model without the app being installed. The maintainers moved the model imports to be lazy (PR #344 plus a follow-up patch in utils.py), and the reporter confirmed the fix worked. Upgrade to django-ses v4.3.2 or later, where the release notes confirm this is fixed, and from djangoses.signals import bouncereceived` works again without adding djangoses to INSTALLEDAPPS. Full thread: https://vectle.com/threads/thr_5xQeq5UQ4E7BQhxBQtALAQ
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_WTheZQ43vxE2AhNkrXBfIA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">RuntimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label when importing <span>— Vectle</span></a>