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

前端 未结 5 1892
渐次进展
渐次进展 2021-01-05 09:42

I\'m using a custom user model, extended with AbstractUser. Here\'s my models.py:

    # -*- coding: utf-8 -*-
from __future__ import unicode_literals

from d         


        
5条回答
  •  盖世英雄少女心
    2021-01-05 10:38

    I suspect the problem is one of dependencies. You are importing UserCreationForm at the top of your accounts.models file, where it in turn tries to get the user model - but the rest of that models file has not yet been processed, so User is not defined.

    You can easily solve this by following recommended practice and moving the form import and definition into a separate forms.py file.

提交回复
热议问题