初次格式化数据库表,出现:
ValueError: Related model 'users.UserProfile' cannot be resolved
解决办法:
1.python manage.py makemigrations --empty users
2.python manage.py makemigrations
3.python manage.py migrate users
4.python manage.py migrate
修改数据库后执行migrations出现:
No changes detected
一般是误删了migrations中的文件,找到要更改的模型的app,执行
python manage.py makemigrations --empty myapp
网友评论