Two URLs are integrated.
1,http://www.phodal.com/blog/django-mezzanine-sqlite3-migrate-mysql/
2,http://www.ziqiangxuetang.com/django/django-data-migration.html
A. Create a Slave database first
DATABASES = { "default": { "ENGINE":"Django.db.backends.sqlite3", "NAME":"dev.db", "USER":"", "PASSWORD":"", "HOST":"", "PORT":"", }, "slave": { "ENGINE":"Django.db.backends.mysql", "NAME":"Phodal", "USER":"Root", "PASSWORD":"", "HOST":"", "PORT":"", },}
B. Then, create an empty database in MySQL and get the table results from the main library from the library:
CREATE DATABASE phodal CHARACTER SET UTF8 COLLATE utf8_general_ci;
Python./manage.py syncdb--database Slave
C. Make sure that the SQL procedure statement for each app is generated, and if not, run the following statement:
Python manage.py makemigrations FAT
D. Export the data from the SQLite Master library:
Python manage.py dumpdata > Mysite_all_data.json
E. Switch the main library and the setting.py settings from the library, set MySQL as the primary library, and import the data.
Python manage.py loaddata Mysite_all_data.json
If the static file Css.js points to an error, run:
Python manage.py collectstatic
Then put the static text repair to the appropriate position.
Django Sqlite3 Database migration to MySQL