django.db.utils.OperationalError: table "brand" already exists

版权声明:未经博主同意,禁止转载。谢谢! https://blog.csdn.net/cp_123321/article/details/86063875

在django项目中生成数据库迁移文件时出现以下错误: 

return Database.Cursor.execute(self, query)
django.db.utils.OperationalError: table "brand" already exists

1 可以将数据库 db.sqlite3 删掉, 然后在执行 以下两条命令

python manage.py makemigrations
python manage.py migrate

2. 如果db.sqlite3 删除不掉的话, 可以删除以下文件, 将类似的文件都删掉, 在执行命令

python manage.py makemigrations
python manage.py migrate

猜你喜欢

转载自blog.csdn.net/cp_123321/article/details/86063875