django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on SQLite

在测试项目中,数据库:sqlite,修改表名时提示错误:

django.db.utils.NotSupportedError: Renaming the 'apps_article' table while in a transaction is not supported on SQLite < 3.26 because it would break referential integrity. 
Try adding `atomic = False` to the Migration class.

中文意思:

SQLite不支持在事务中重命名apps_article表,因为它会破坏参照完整性。尝试添加atomic = False到Migration类。

解决方法:

文件路径:项目路径\apps\migrations\0006_auto_20190708_1144.py

from django.db import migrations


class Migration(migrations.Migration):
    atomic = False  # 添加atomic
    dependencies = [
        ('apps', '0005_auto_20190701_2022'),    ]

    operations = [
        migrations.AlterModelOptions(
            name='article',            options={'ordering': ['-pub_date'], 'verbose_name': '文章表', 'verbose_name_plural': '文章表'},        ),        migrations.AlterModelTable(
            name='article',            table='article',    ]


相关文章

注:所有源代码均实测运行过。所有源代码均已上传CSDN,请有...
继承APIView和ViewSetMixin;作用也与APIView基本类似,提供...
一、Django介绍Python下有许多款不同的 Web 框架。Django是重...
本文从nginx快速掌握到使用,gunicorn快速掌握到使用,实现小...
uniapp微信小程序订阅消息发送服务通知
Django终端打印SQL语句 1 Setting配置: 2 默认python 使用的...