@dashkevi4mike

Ошибка с кастомной моделью юзера на django 1.8?

ошибка возникла при переносе проекта с django 1.6 на django 1.8
у меня есть кастомная моделька юзера
class Profile(AbstractUser):
    middle_name = models.CharField(max_length=70, blank=True, verbose_name=_("Middle name"))
    gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
    phone = models.CharField(max_length=150, blank=True, verbose_name=_("Phone"))
    status = models.CharField(max_length=500, blank=True, verbose_name=_("Status"))
    education = models.CharField(max_length=350, blank=True, verbose_name=_("Education"))
    progress_display = models.BooleanField(default=True, blank=True, verbose_name=_("Display progress"))
    about = models.TextField(blank=True, verbose_name=_("description about"))
    city = models.CharField(max_length=75, blank=True, verbose_name=_("City"))
    current_city = models.CharField(max_length=75, blank=True, verbose_name=_("Current city"))
    birth = models.DateTimeField(blank=True, null=True, verbose_name=_("Birthday"))
    registered = models.DateTimeField(auto_now=True, help_text=_('Registration date'),
                                      verbose_name=_("registration date"))
    is_teacher = models.BooleanField(default=False, blank=True, verbose_name=_("is_teacher"))
    hide_fields = models.CharField(max_length=255, blank=True)
    subscription = models.BooleanField(default=False, blank=True, verbose_name='Подписка на рассылку')
    main_photo = models.ForeignKey('avatar.Photo', blank=True, verbose_name=_("user main-photo"), related_name='avatar', default=None, null=True)

    class Meta:
        verbose_name = _('User')
        verbose_name_plural = _('Users')
        ordering = ('-registered', 'id')
        get_latest_by = 'registered'

Все мои приложения находятся в отдельной папке "applications", путь до которой я указываю в settings.py вот так:
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(BASE_DIR, 'applications'))

тут же я указываю ссыль на кастомную модельку юзера
AUTH_USER_MODEL = 'profile.Profile'
Вот мой INSTALLED_APPS
INSTALLED_APPS = (
    'social',
    'photo',
    'profile',
    'qa',
    'main',
    'learn',
    'donate',
    'notifications',
    'articles',
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.contenttypes',
    'grappelli',
    'django_extensions',
    'django.contrib.admin',
    'rest_framework',
    'djkombu',
    'autofixture',
    'crispy_forms'    
)

Команды "runserser", 'makemigrations' и 'migrate' работают отлично, а вот "createsuperuser" возвращает следующее:
Traceback (most recent call last):
  File "/opt/pycharm-3.0.2/helpers/pycharm/django_manage.py", line 23, in <module>
    run_module(manage_file, None, '__main__', True)
  File "/usr/lib/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/camaro/programming/imedrese/master/manage.py", line 14, in <module>
    execute_from_command_line(sys.argv)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 190, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 41, in load_command_class
    return module.Command()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 28, in __init__
    self.UserModel = get_user_model()
  File "/home/camaro/programming/imedrese/master/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 155, in get_user_model
    "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'profile.Profile' that has not been installed
  • Вопрос задан
  • 2366 просмотров
Пригласить эксперта
Ответы на вопрос 2
sim3x
@sim3x
Ответ написан
Комментировать
@balamut108
Py
Модель не по документации сделана: django.readthedocs.org/en/1.8.x/topics/auth/custom...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы