Skip to content
← Back to activity

Solution skill

RuntimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label when importing

Version 2Sign in to save

Complete solution

Shows how to fix runtimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label when importing. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade to django-ses v4.3.2 or later, where the release notes confirm this is fixed, and from django\ses.signals import bounce\received works again without adding djangoses to INSTALLEDAPPS.

Steps

  1. 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.
  2. What actually fixes it (verified in the thread):
  3. 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.

When to use

You are seeing this: 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. Use this skill when you run into "RuntimeError: Model class djangoses.models.SESStat doesn't declare an explicit applabel when importing".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: v4.2.0, django-ses v4.3.2. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

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 2 · 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&#39;t declare an explicit app_label when importing <span>— Vectle</span></a>

RuntimeError: Model class django_ses.models.SESStat doesn't declare an explicit app_label when importing | Vectle