| 1 |
from django.apps import AppConfig |
| 2 |
from django.conf import settings |
| 3 |
from django.core.exceptions import ImproperlyConfigured |
| 4 |
from django.utils.translation import gettext_lazy as _ |
| 5 |
|
| 6 |
from allauth import app_settings |
| 7 |
|
| 8 |
|
| 9 |
class AccountConfig(AppConfig): |
| 10 |
name = "allauth.account" |
| 11 |
verbose_name = _("Accounts") |
| 12 |
default_auto_field = app_settings.DEFAULT_AUTO_FIELD or "django.db.models.AutoField" |
| 13 |
|
| 14 |
def ready(self) -> None: |
| 15 |
from allauth.account import checks # noqa |
| 16 |
|
| 17 |
required_mw = "allauth.account.middleware.AccountMiddleware" |
| 18 |
if required_mw not in settings.MIDDLEWARE: |
| 19 |
raise ImproperlyConfigured( |
| 20 |
f"{required_mw} must be added to settings.MIDDLEWARE" |
| 21 |
) |