1

時拍攝的進口問題,我在app.models定義的自定義User模型。在AUTH_USER_MODEL設置中也正確定義爲app.User。當我運行該網站時,一切正常。Django的自定義用戶在運行時同步分貝

然而,當我運行./manage.py syncdb --migrate它打破了以下回溯:

Traceback (most recent call last): 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 222, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute 
    output = self.handle(*args, **options) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 386, in handle 
    return self.handle_noargs(**options) 
    File ".virtualenv/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 103, in handle_noargs 
    management.call_command('migrate', **options) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 161, in call_command 
    return klass.execute(*args, **defaults) 
    File ".virtualenv/lib/python2.7/site-packages/raven/contrib/django/management/__init__.py", line 37, in new_execute 
    return original_func(self, *args, **kwargs) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 255, in execute 
    output = self.handle(*args, **options) 
    File ".virtualenv/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle 
    ignore_ghosts = ignore_ghosts, 
    File ".virtualenv/lib/python2.7/site-packages/south/migration/__init__.py", line 233, in migrate_app 
    migrator.load_initial_data(target, db=database) 
    File ".virtualenv/lib/python2.7/site-packages/south/migration/migrators.py", line 224, in load_initial_data 
    call_command('loaddata', 'initial_data', verbosity=self.verbosity, database=db) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 161, in call_command 
    return klass.execute(*args, **defaults) 
    File ".virtualenv/lib/python2.7/site-packages/raven/contrib/django/management/__init__.py", line 37, in new_execute 
    return original_func(self, *args, **kwargs) 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 254, in execute 
    self.validate() 
    File ".virtualenv/lib/python2.7/site-packages/django/core/management/base.py", line 285, in validate 
    raise CommandError("One or more models did not validate:\n%s" % error_text) 
CommandError: One or more models did not validate: 
auth.user: Model has been swapped out for 'app.User' which has not been installed or is abstract. 

當我運行./manage.py syncdb --migrate app一切運行正常,所以我不明白這是怎麼回事這裏。有人有線索嗎?

編輯:訂購我安裝的應用程序:

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.admin', 
    'django.contrib.webdesign', 
    'django.contrib.staticfiles', 
    'djcelery', 
    'app', 

    'babeldjango', 
    'debug_toolbar', 
    'template_timings_panel', 
    'devserver', 
    'django_extensions', 
    'djrill', 
    'facebook_tag', 
    'gunicorn', 
    'haystack', 
    'markitup', 
    'modeltranslation', 
    'raven.contrib.django', 
    'reversion', 
    'rosetta', 
    'sorl.thumbnail', 
    'south', 
    'statictastic', 
    'storages', 
    'twitter_tag', 
    'zebra', 
    'djcelery', 
    'djmoney_rates' 
) 

編輯2:這個問題似乎是在第三方應用程序運行遷移產生的。如果我評論那些有遷移的應用,一切都會順利進行。我想這也是意料之中的,因爲./manage.py migrate app工作正常,但./manage.py migrate(運行遷移所有的應用程序)沒有。和建設關的信息和跟蹤,似乎我app的模型根本無法獲得當第三方應用「遷移正在運行。

+0

你有''INSTALLED_APPS' app'? – twil

+0

@twil,是的。我剛添加了我的'INSTALLED_APPS'。 – tzenderman

+0

將應用程序移到列表中。 Django關心模型排序的度量標準。 (在它們各自的文件至少) –

回答

2

有同樣的問題,解決了其遷移從南0.8.3南0.8.4

看到,這裏的解決方案:http://south.aeracode.org/ticket/1179

+0

儘管此鏈接可能回答此問題,但最好在此處包含答案的重要部分,並提供供參考的鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。 – Cyclonecode

+1

@KristerAndersson,這不是一個鏈接唯一的答案。這並不是說它的質量不是很低(我對手邊的主題不夠熟悉,無法判斷,但是如果你是這樣,那就低估它)。儘管答案在細節上很少,但它確實不僅僅是一個鏈接:它讓我們知道我們應該從一個軟件版本轉移到另一個版本。這並不多,但它是一個有效的答案。當答案不是答案時,請參閱您的答案在另一個城堡中:http://meta.stackexchange.com/questions/225370/your-answer-is-in-another-castle-when-is-an-answer-不-的回答 – ArtOfWarfare