[Django] #30450: Cannot import AbstractUser

21 views
Skip to first unread message

Django

unread,
May 6, 2019, 12:15:03 PM5/6/19
to django-...@googlegroups.com
#30450: Cannot import AbstractUser
-----------------------------------------+------------------------
Reporter: fbuccioni | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
When import AbstractUser from my models, reading the views the follow
error is raised:


{{{
File "/apps/authn/serializers.py", line 3, in <module>
from . import models
File "/apps/authn/models.py", line 6, in <module>
from django.contrib.auth.models import AbstractBaseUser
File "/virtualenv/lib/python3.5/site-
packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser,
BaseUserManager
File "/virtualenv/lib/python3.5/site-
packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/virtualenv/lib/python3.5/site-packages/django/db/models/base.py",
line 100, in __new__
app_config = apps.get_containing_app_config(module)
File "/virtualenv/lib/python3.5/site-packages/django/apps/registry.py",
line 244, in get_containing_app_config
self.check_apps_ready()
File "/virtualenv/lib/python3.5/site-packages/django/apps/registry.py",
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.

Cheers

--
Ticket URL: <https://code.djangoproject.com/ticket/30450>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 6, 2019, 12:26:21 PM5/6/19
to django-...@googlegroups.com
#30450: Cannot import AbstractUser
-------------------------------+--------------------------------------

Reporter: fbuccioni | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by fbuccioni:

Old description:

New description:

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


{{{
File "/apps/authn/__init__.py", line 4, in <module>
from .urls import urls
File "/apps/authn/urls.py", line 2, in <module>
from . import views
File "/apps/authn/views/__init__.py", line 21, in <module>


from . import models
File "/apps/authn/models.py", line 6, in <module>
from django.contrib.auth.models import AbstractBaseUser
File "/virtualenv/lib/python3.5/site-
packages/django/contrib/auth/models.py", line 2, in <module>
from django.contrib.auth.base_user import AbstractBaseUser,
BaseUserManager
File "/virtualenv/lib/python3.5/site-
packages/django/contrib/auth/base_user.py", line 47, in <module>
class AbstractBaseUser(models.Model):
File "/virtualenv/lib/python3.5/site-packages/django/db/models/base.py",
line 100, in __new__
app_config = apps.get_containing_app_config(module)
File "/virtualenv/lib/python3.5/site-packages/django/apps/registry.py",
line 244, in get_containing_app_config
self.check_apps_ready()
File "/virtualenv/lib/python3.5/site-packages/django/apps/registry.py",
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.

Cheers

--

--
Ticket URL: <https://code.djangoproject.com/ticket/30450#comment:1>

Django

unread,
May 6, 2019, 12:29:52 PM5/6/19
to django-...@googlegroups.com
#30450: Cannot import AbstractBaseUser
-------------------------------+--------------------------------------

Reporter: fbuccioni | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/30450#comment:2>

Django

unread,
May 7, 2019, 1:23:59 AM5/7/19
to django-...@googlegroups.com
#30450: Cannot import AbstractBaseUser.
---------------------------------+--------------------------------------
Reporter: Felipe Buccioni | Owner: nobody
Type: Bug | Status: closed
Component: Core (Other) | Version: master
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by felixxm):

* status: new => closed
* component: Uncategorized => Core (Other)
* version: 2.0 => master
* resolution: => invalid


Comment:

Thanks for the report, however it is rather support question not and issue
in Django. You shouldn't import `urls` inside `__init__.py` IMO (see
[https://docs.djangoproject.com/en/2.2/ref/applications/#how-applications-
are-loaded how-applications-are-loaded]). Closing per
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/30450#comment:3>

Reply all
Reply to author
Forward
0 new messages