6π
This problems generally resides between 2 reasons.
- When the dependencies order in installed apps are reversed.
- When you havenβt mentioned the dependency in the installed apps at all.
Here in this case grappelli seems to raise the issue telling auth.User
not found. It means it is not able to find any package auth
. If you are using the default user model remove that AUTH_USER_MODEL
setting from the config or if you are using any custom user model in package βauthβ list it in installed apps.
3π
I run into the op issue as soon as I decided to migrate from a single models.py
file to a models
folder containing a user.py
file to define the custom User
model.
In that case, as explained here, the trick is to ensure to import your model info the __init__.py
file of your models
folder.
For example, if your directory structure is:
profiles
models
__init__.py
user.py
In the __init__.py
file, add from .user import User
- In python django how do you print out an object's introspection? The list of all public methods of that object (variable and/or functions)?
- Is there any way to use GUIDs in django?
- How can I disable a model field in a django form
- Django: values_list() multiple fields concatenated
- How do I get the django HttpRequest from a django rest framework Request?
2π
A complete traceback would help to diagnose it better. Prima facie, it seems to me as a dependency issue caused due to migration. Check what Django docs have to say about this β
Due to limitations of Djangoβs dynamic dependency feature for
swappable models, you must ensure that the model referenced by
AUTH_USER_MODEL is created in the first migration of its app (usually
called 0001_initial); otherwise, you will have dependency issues.
Hereβs the link β https://docs.djangoproject.com/en/1.9/topics/auth/customizing/
- Assign Value of Named URL to a Variable in Django Templates
- How to specify uniqueness for a tuple of field in a Django model
- How do I use perform_create to set a field automatically in Django Rest Framework?
- Django model inheritance and type check
- Django OneToOneField with possible blank field
2π
if your application is not called auth you have to replace it:
AUTH_USER_MODEL='your_app_name.User'
- How can i get all models in django 1.8
- Django global variable
- Django 1.6 and django-registration: built-in authentication views not picked up
- Python: How can I override one module in a package with a modified version that lives outside the package?
- How to use ModelMultipleChoiceFilter?
1π
Once I had the same issue in v-2.2 then I realized that the spelling of βregisterβ in the admin.py file was wrong.
- Why does Django South require a default value when removing a field?
- Determine if an attribute is a `DeferredAttribute` in django
- How to filter filter_horizontal in Django admin?
1π
This is becuase you have an app βauthβ in which you have defined your user model.
and You have not mentioned app name in INSTALLED_APPS dictionary.
Try Adding your app name in INSTALLED_APPS and check.
- Django queryset __contains case sensitive?
- Django collectstatic no such file or directory
- Django on Google App Engine
- Django Views: When is request.data a dict vs a QueryDict?
- Paypal monthly subscription plan settings for first day of the month and making monthly recurring payment β django python
- Logout Django Rest Framework JWT
- How to use ModelMultipleChoiceFilter?
- Return list of objects as dictionary with keys as the objects id with django rest framerwork
- In python django how do you print out an object's introspection? The list of all public methods of that object (variable and/or functions)?
- How to test (using unittest) the HTML output of a Django view?
0π
This error may also appear due to a missing import of a model in an admin.py (Django version 2.2).
0π
Try make the migrations first; python manage.py makemigrations. This might detect if you have any problems with your imports which you can fix then run the server to verify
- Using a Django variable in a CSS file
- Is there any list of blog engines, written in Django?
- How to give initial value in modelform
- Django global variable
0π
I doubt this is the typical answer, but I hit this problem when I using reverse
and should have been using reverse_lazy
. Changing to reverse_lazy
fixed it for me.
- 'admin' is not a registered namespace in Django 1.4
- Determine if an attribute is a `DeferredAttribute` in django
- Django: Generic views based 'as_view()' method
- Does Django have a way to open a HTTP long poll connection?
0π
This error appeared when I had an improperly configured model and added it to the admin backend.
Wrong:
class VolunteerExperience:
...
Correct:
class VolunteerExperience(models.Model):
...
I hope this helps someone who gets misdirected by the exception message "django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'auth.User' that has not been installed"
Now I know that this message most likely indicates an incorrectly configured model.
- All the values of the many to many field : Django
- Appropriate choice of authentication class for python REST API used by web app
- How to test a Django on_commit hook without clearing the database?
- Validating a Django model field based on another field's value?
0π
In addition to all the other answers, I ran into this issue when I upgraded Django. I had an import that was deprecated from one release to another. Make sure to check the release notes/version histories before upgrading any package.
- Django Foreign Key: get related model?
- How to concatenate two model fields in a Django QuerySet?
- Django render_to_string() ignores {% csrf_token %}
- Django, REST and Angular Routes
- {% load static %} and {% load staticfiles %}: which is preferred?
0π
if anyone get this error again, maybe this will help
I hardly struggled to debug this error the whole day.
The problem is that I wrote the model in my main app and not in the authentication app.
- Error loading MySQLdb module: libmysqlclient.so.20: cannot open shared object file: No such file or directory
- Is there any way to use GUIDs in django?
- Django ALLOWED_HOSTS with ELB HealthCheck
- Using a Django variable in a CSS file
0π
I spent a lot of time in debugging this but I donβt know how this problem was occurring but this just got solved when I change my class name from:
class User(AbstractUser):
#to
class CustomUser(AbstractUser):
#and in settings.py:
AUTH_USER_MODEL = 'api.CustomUser'
- How do you divide your project into applications in Django?
- 'admin' is not a registered namespace in Django 1.4
0π
I had the same issue and solved by:
Commenting out USER GROUPS that I had created in the models.py
; forexample.
TA,created=Group.objects.get_or_create(name='teachers')
Final word:
- Comment your defined user groups forexample:
#TA,created=Group.objects.get_or_create(name='teachers')
- Run
python makemigrations your_project_name
python migrate your_project_name
- Then, uncomment your defined your groups:
TA,created=Group.objects.get_or_create(name='teachers')
And you are good to go.
0π
In my case, I had to update the admin.py file and include my user model. For example, I have a folder called model inside my app, which has a folder login and a usuario.py file with a Usuario class.
Then, in the app folder, I updated the admin.py file to include that model.
from django.contrib import admin
# Register your models here.
from .model.login.usuario import Usuario
- How to filter filter_horizontal in Django admin?
- Django template indentation guideline
- Django how to override clean() method in a subclass of custom form?
- Django-admin.py startproject opens notepad, instead of creating a project
0π
For me, it turned out to be the placement of an import statement.
I needed to import model Notes into my users/models.py from a separate Django project where I couldnβt change anything.
Model Notes had a fk-field to User via django.contrib.auth.get_user_model(). I needed to inherit this model in the same models.py file as my custom User model.
Moving the import statement after the User model fixed the error:
from django.contrib.auth.models import AbstractUser
class UserProfile(AbstractUser):
...
from notes_project.notes.models import Note
class SpecialNotes(Notes):
...
- Python Django custom template tags register.assignment_tag not working
- How to concatenate two model fields in a Django QuerySet?
- How do I get the django HttpRequest from a django rest framework Request?
- Why does Django South 1.0 use iteritems()?