4

Trying to debug this error with getting a Django project running

ImproperlyConfigured: AUTH_USER_MODEL refers to model 'accounts.User' that has not been installed

Running

python manage.py migrate

Must iterate i am in no way a python or django expert - I have simply inherited someone elses project that I am trying to get running for the team here.

I have followed steps to

install postgres
required modules including south
creating database for postgres

Any help appreciated on how to debug this.

settings/base.py contains

INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

LOCAL_APPS = (
    'apps.core',
    'apps.accounts',
    'apps.project_tool',
    'apps.internal',
    'apps.external',
)

so apps.accounts exits - but it asks for AUTH_USER_MODEL = 'accounts.User' - should it be

AUTH_USER_MODEL = 'apps.accounts.User'?
4
  • did you actually solved this? Commented Mar 16, 2014 at 20:34
  • Use python manage.py migrate --traceback Commented May 18, 2014 at 9:35
  • 1
    Are you overwriting LOCAL_APPS after assigning it to INSTALLED_APP? Or did you switch the order when posting? Commented Oct 15, 2015 at 20:04
  • it's an import issue see stackoverflow.com/questions/48077112/… Commented Jan 29, 2019 at 21:32

3 Answers 3

2

I'd assume that the accounts app hasn't been added to your INSTALLED_APPS in settings.py.

Sign up to request clarification or add additional context in comments.

6 Comments

There is no settings.py - but a settings folder with a file called base.py within :
Then your project layout has been customized. Please check your manage.py for a line like the following: os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings"). The value instead of "myproject.settings" should give you a hint on where to look instead of settings.py
yeah - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.production") = so settings folder - production.py - which probably includes the other files such as base.py - so I think I am looking in the right place
Then you should find a production.py in a settings directory. This file should then contain the INSTALLED_APPS setting that I mentioned.
Hiya I edited my question above earlier with more details on that - I found all the info you mentioned :)
|
2

I'm aware this is an old question but I struggled with this issue for two days before finding my mistake, which was failing to follow the models organization in the Django Models docs.

If you have the AUTH_USER_MODEL = <app_name>.<user_model> correctly written, and you have your '<app_name>', in your INSTALLED_APPS list, but you're still getting this error, it's possible that your <custom_user> model (e.g. User) is in the wrong place.

It needs to be defined in either:

  • <app_name>.models.py

OR

  • <app_name>/models/<arbitrary_name>.py AND there is an <app_name>/models/__init__.py that contains the line from .<arbitrary_name> import <custom_user>

1 Comment

Re-exporting the <app_name>/models/<arbitrary_name>.py worked for me on Django 4.2.
0

Are you running South 0.8.3?

Ensure that you running South at least 0.8.4

GitHub issue South Release Notes

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.