如何将Django中的数据从sqlite传输到mysql,以便保留管理中的所有数据?

2024-04-28 08:07:53 发布

您现在位置:Python中文网/ 问答频道 /正文

如何将django中的数据从sqlite传输到mysql,以便保留管理中的所有数据?在

我有一个具有相同表的数据库,可以在其中传输所有数据。我试着用标准的方法来做。 数据被传输到了管理层。我使用wagtail django管理。在

更清楚地说,我需要的是信息,而不是结构本身


Tags: 数据django方法信息数据库sqlite标准mysql
1条回答
网友
1楼 · 发布于 2024-04-28 08:07:53
    1) python manage.py dumpdata > datadump.json

    2) Change settings.py to your mysql

    3) Make sure you can connect on your mysql (permissions,etc)

    4) python manage.py migrate  run-syncdb

    5) Exclude contentype data with this snippet

    6) from django.contrib.contenttypes.models import ContentType
        ContentType.objects.all().delete()
        quit()

    7) python manage.py loaddata datadump.json

相关问题 更多 >