Opened 5 years ago

Closed 5 years ago

#30450 closed Bug (invalid)

Cannot import AbstractBaseUser.

Reported by: Felipe Buccioni Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Felipe Buccioni)

When import AbstractUser from my models, reading the views the follow error is raised:

  File "/apps/authn/", line 4, in <module>
    from .urls import urls
  File "/apps/authn/", line 2, in <module>
    from . import views
  File "/apps/authn/views/", line 21, in <module>
    from . import models
  File "/apps/authn/", line 6, in <module>
    from django.contrib.auth.models import AbstractBaseUser
  File "/virtualenv/lib/python3.5/site-packages/django/contrib/auth/", line 2, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/virtualenv/lib/python3.5/site-packages/django/contrib/auth/", line 47, in <module>
    class AbstractBaseUser(models.Model):
  File "/virtualenv/lib/python3.5/site-packages/django/db/models/", line 100, in __new__
    app_config = apps.get_containing_app_config(module)
  File "/virtualenv/lib/python3.5/site-packages/django/apps/", line 244, in get_containing_app_config
  File "/virtualenv/lib/python3.5/site-packages/django/apps/", line 127, in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

I am using django 2.0 but in 1.11 I had the same problem.


Change History (3)

comment:1 by Felipe Buccioni, 5 years ago

Description: modified (diff)

comment:2 by Felipe Buccioni, 5 years ago

Summary: Cannot import AbstractUserCannot import AbstractBaseUser

comment:3 by Mariusz Felisiak, 5 years ago

Component: UncategorizedCore (Other)
Resolution: invalid
Status: newclosed
Summary: Cannot import AbstractBaseUserCannot import AbstractBaseUser.
Version: 2.0master

Thanks for the report, however it is rather support question not and issue in Django. You shouldn't import urls inside IMO (see how-applications-are-loaded). Closing per TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top