2
從Django的1.7.4遷移我的項目時1.8.5Django的1.8.5遷移失敗AbstractUser模型
在我的項目我有一個奇怪的問題,我擴展了用戶的基本模型,像這樣:
App用戶:
class User(AbstractUser):
age = models.IntegerField()
def __unicode__(self):
return self.username
現在在Django 1.8.5遷移因爲某些原因我不得不這樣做
python manage.py makemigrations
開始時
這將爲用戶應用程序進行遷移。
如果我以後做這
python manage.py migrate
直接就失敗,此錯誤
django.db.utils.ProgrammingError: relation "users_user" does not exist
然後我做的:
python manage.py migrate users
從而未能
"Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure
contenttypes is migrated before trying to migrate apps individually.
有趣的是,即使失敗了,現在正在運行
python manage.py migrate
作品
Operations to perform:
Synchronize unmigrated apps: messages, staticfiles, django_extensions, allauth, avatar, crispy_forms, debug_toolbar
Apply all migrations: sessions, users, contenttypes, admin, sites, account, auth, socialaccount
Synchronizing apps without migrations:
Creating tables...
Creating table avatar_avatar
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying account.0001_initial... OK
Applying account.0002_email_max_length... OK
Applying admin.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_set_site_domain_and_name... OK
Applying sites.0003_auto_20151104_1309... OK
Applying socialaccount.0001_initial... OK
從舊的Django版本遷移到1.8時,任何人都經歷了同樣的問題?
謝謝你,這是當場。但是現在我得到另一個錯誤,「關係django_site不存在」。但是這固定了我所問的問題。我將不得不看看另一個 – Donna
祝你好運:) - 我認爲應該看的東西是:缺少的應用程序(contrib.something?),任何應用程序做一些有趣的代碼檢查/模型加載(如django調試工具欄)和依賴關係。 –