【发布时间】:2015-01-16 05:10:39
【问题描述】:
我正在生产中,刚刚运行syncdb,但我犯了一个错误,想删除syncdb 所做的事情,包括表中的所有数据都可以。只是在数据库中重新开始,所以我可以再次运行 syncdb。
(virtualenv-2.7)[root@server mysite]# python manage.py sqlclear mainapp | python manage.py dbshell
CommandError: One or more models did not validate:
app.comment: 'poster' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.
app.myuser: The field named as the USERNAME_FIELD should not be included in REQUIRED_FIELDS on a swappable User model.
【问题讨论】:
-
你使用什么样的数据库(MySQL、Postgres...等)?
-
drop database whatever_your_database_name; create databse whatever_your_database_name;? -
@Raja 我只想再次运行
syncdb -
@Raja 你是什么意思?我做了一些更改,并希望从新填充它们。我可能会尝试 JOHN 解决方案
标签: python django python-2.7 django-1.7