Django 德扬戈。用户模型的问题

Django 德扬戈。用户模型的问题,django,Django,我在将项目从Django1.6更新到Django1.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.

我在将项目从Django1.6更新到Django1.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'
我的应用程序位于单独的文件夹(“应用程序”)中。我在如下设置中定义的文件夹的路径:

BASE_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(BASE_DIR, 'applications'))
我还可以在设置中定义自定义用户模型(位于配置文件应用程序中)

这是我的安装应用程序:

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
回溯(最近一次呼叫最后一次):
文件“/opt/pycharm-3.0.2/helpers/pycharm/django_manage.py”,第23行,中
运行\u模块(管理\u文件,无,'.\u主\u',真)
文件“/usr/lib/python2.7/runpy.py”,第176行,在run_模块中
fname、loader、pkg_名称)
文件“/usr/lib/python2.7/runpy.py”,第82行,在运行模块代码中
模块名称、模块名称、模块加载器、包装名称)
文件“/usr/lib/python2.7/runpy.py”,第72行,在运行代码中
run_globals中的exec代码
文件“/home/camaro/programming/imedrese/master/manage.py”,第14行,在
从命令行(sys.argv)执行命令
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/core/management/_init__.py”,第338行,从命令行执行
utility.execute()
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/core/management/_init__.py”,第330行,执行
self.fetch_命令(子命令)。从_argv(self.argv)运行_
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/core/management/_init__.py”,第190行,在fetch_命令中
klass=加载命令类(应用程序名称,子命令)
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/core/management/_init__.py”,第41行,装入命令类
返回module.Command()
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/contrib/auth/management/commands/createsuperuser.py”,第28行,在__
self.UserModel=get\u user\u model()
文件“/home/camaro/programming/imedrese/master/local/lib/python2.7/site packages/django/contrib/auth/_init__.py”,第155行,在get_user_模型中
验证用户模型引用了尚未安装的模型“%s”%settings.AUTH用户模型
django.core.exceptions.ImpropertlyConfigured:身份验证用户模型引用了尚未安装的模型“profile.profile”

我的声誉不足以对你的问题发表评论,所以我把这个放在这里作为答案,即使它不能回答你的问题

根据关于扩展
用户
-模型的说明,您的方法似乎是-对不起-错误的。就我从您的代码中所见,除了向帐户添加更多信息之外,您的
配置文件没有做任何特殊的事情。这可以通过使用与原始Django用户的
OneToOne
-关系来完成(如链接文档中所述)


也就是说:我不明白为什么你的模型在升级到1.8时会停止工作。您是否检查了或,如果他们更改了有关自定义用户模型的任何内容?

这没有错,但这是一个问题。我的问题是项目中的文件结构=)
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