参考: http://www.voidcn.com/article/p-hesvaooz-ru.html

原文:
python ./manage.py syncdb --database slave

 

变更为:
python manage.py migrate --run-syncdb --database slave

  

 
原文:
from django.contrib.contenttypes.models import ContentType

def run():

    def do(Table):
if Table is not None:
table_objects = Table.objects.all()
for i in table_objects:
i.save(using='slave') ContentType.objects.using('slave').all().delete() for i in ContentType.objects.all():
do(i.model_class())
变更为
# -*- coding:utf-8 -*-
from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType
def run():
failed_list = [] def do(table):
if table is not None:
try:
table_objects = table.objects.all()
for i in table_objects:
i.save(using='slave')
except:
failed_list.append(table) ContentType.objects.using('slave').all().delete() for i in ContentType.objects.all():
do(i.model_class()) while failed_list:
table = failed_list.pop(0)
do(table)
 

django 10.5 sqlite3迁移到mysql的更多相关文章

  1. django数据库迁移相关【sqlite3迁移到MySQL】(django2.0.3测试通过)

    前言 项目部署到服务器之后,用的数据库还是sqlite3. 发现一些问题,sqlite3是小巧,但是服务器上查看数据库比较费劲,不能直观看到数据.可是我们经常需要即时.直观查看数据,这就用到MySQL ...

  2. 搭建 python 3.5+pycharm 2017.1.3+django 1.12.0 首次 将sqlite3 迁移到mysql

  3. Django2 SQLite3迁移到MySQL数据库

    https://blog.csdn.net/weixin_34257076/article/details/86843658

  4. Django Sqlite3 数据库向MySQL迁移

    整合了两个URL而来.. 1,http://www.phodal.com/blog/django-mezzanine-sqlite3-migrate-mysql/ 2,http://www.ziqia ...

  5. Django基础 - 修改默认SQLite3数据库连接为MySQL

    Django数据库连接默认为SQLite3,打开setting.py可以看到数据库部分的配置如下: DATABASES = { 'default': { 'ENGINE': 'django.db.ba ...

  6. Django中把SQLite数据库转换为Mysql数据库的配置方法

    我们在学习和开发Django的时候,一般是使用SQLite作为数据库.在正式讲网站部署上线是用MySQL数据库比较多.MySQL支持高并发的访问,而且相对于SQLite,MySQL性能更好.下面讲讲如 ...

  7. 将sqllite3数据库迁移到mysql

    一.安装python mysql module (OneDrive): 1.运行python D:\OneDrive\Work\django\mysqlregistry.py2.http://www. ...

  8. Django更换数据库和迁移数据方案

    前言 双十一光顾着买东西都没怎么写文章,现在笔记里还有十几篇半成品文章没写完- 今天来分享一下 Django 项目切换数据库和迁移数据的方案,网络上找到的文章方法不一,且使用中容易遇到各类报错,本文根 ...

  9. 各种主流 SQLServer 迁移到 MySQL 工具对比

          我之所以会写这篇对比文章,是因为公司新产品研发真实经历过这个痛苦过程(传统基于SQL Server开发的C/S产品转为MySQL云产品).首次需要数据转换是测试环节,当时为了快速验证新研发 ...

随机推荐

  1. 常用的Date对象和Math对象方法

    Date对象方法: 当前用户本地时间 let time = new Date(); 获取整数年 console.log(time.getFullYear()); 获取当前月(月份要加1) consol ...

  2. FCN 32分析:

    FCN 32s

  3. 把ui界面加入到工程中

    第一步   from untitled import Ui_Form untitled是ui转化成py的文件名:Ui_Form是转换后的类名 第二步  把Ui_Form做为工程的父类    class ...

  4. 顺序列表(栈/队列等)ADT[C++]

    #include<iostream> using namespace std; //ADT template<class T> class SeqList{ public: / ...

  5. H.264 SVC

    视频厂商POLYCOM,VIDYO和RADVISION等都推出H.264 SVC技术.针对H.264 SVC技术做个介绍. CISCO和POLYCOM都提供了免版税的H.264 SVC的版本. 其中o ...

  6. python - class类 (五) 继承补充-子类继承父类属性/函数方法

    子类继承父类属性/函数方法: #方式一:(原生方式,不建议使用) class Dongwu(object): def __init__(self,name,sex,old): self.name = ...

  7. PLSQL_day01

    declare begin  dbms_output.put_line('Hello world') end;

  8. Linux下的换行符\n\r以及txt和word文档的使用

    Linux doc WINDOWS下记事本编写的文档和LINUX下VIM或者GEDIT等编写的文档的不同! 例如WINDOWS下编写的SH脚本,放到LINUX下执行可能会出错. 解决方法: 原因是:W ...

  9. 【逆向工具】使用x64dbg+spy去除WinRAR5.40(64位)广告弹框

    1 学习目标 WinRAR5.40(64位)的弹框广告去除,由于我的系统为x64版本,所以安装了WinRAR(x64)版本. OD无法调试64位的程序,可以让我熟悉x64dbg进行调试的界面. 其次是 ...

  10. Linux设备驱动之Ioctl控制【转】

    转自:http://www.cnblogs.com/geneil/archive/2011/12/04/2275372.html 大部分驱动除了需要具备读写设备的能力之外,还需要具备对硬件控制的能力. ...