I need to migrate my db from sqlite to mysql, and the various tools/scripts out there are too many for me to easily spot the safest and most elegant solution.
我需要将我的db从sqlite迁移到mysql,而且各种工具/脚本对我来说太多了,我无法轻松找到最安全、最优雅的解决方案。
This seemed to me nice http://djangosnippets.org/snippets/14/ but appears to be 3 years since getting an update which is worrying..
这在我看来是很不错的http://djangosnippets.org/snippets/14/,但是自从有更新以来已经有3年了,这令人担忧。
Can you recommend a solution that is known to be reliable with Django 1.1.1 ?
您能推荐一个已知可靠的Django 1.1.1解决方案吗?
2 个解决方案
#1
61
Execute:
执行:
python manage.py dumpdata > datadump.json
Next, change your settings.py to the mysql database.
接下来,更改你的设置。py到mysql数据库。
Finally:
最后:
python manage.py loaddata datadump.json
#2
29
After some hard searching I got several problems that I hope future answer looking people will find useful.
经过一番努力的搜索,我发现了几个问题,我希望未来的答案会对人们有用。
my formula is
我的公式是
python manage.py dumpdata > datadump.json
- python管理。py dumpdata > datadump.json
- Change settings.py to your mysql
- 改变设置。py你的mysql
- Make sure you can connect on your mysql (permissions,etc)
- 确保可以连接到mysql(权限等)
python manage.py migrate --run-syncdb
- python管理。py——run-syncdb迁移
-
Exclude contentype data with this snippet
将contentype数据排除在此代码段中。
from django.contrib.contenttypes.models import ContentType ContentType.objects.all().delete() quit()
从django.contrib.contenttypes。模型导入内容类型ContentType.objects.all().delete()
-
python manage.py loaddata datadump.json
python管理。py loaddata datadump.json
Hope that will help you!
希望这能对你有所帮助!
#1
61
Execute:
执行:
python manage.py dumpdata > datadump.json
Next, change your settings.py to the mysql database.
接下来,更改你的设置。py到mysql数据库。
Finally:
最后:
python manage.py loaddata datadump.json
#2
29
After some hard searching I got several problems that I hope future answer looking people will find useful.
经过一番努力的搜索,我发现了几个问题,我希望未来的答案会对人们有用。
my formula is
我的公式是
python manage.py dumpdata > datadump.json
- python管理。py dumpdata > datadump.json
- Change settings.py to your mysql
- 改变设置。py你的mysql
- Make sure you can connect on your mysql (permissions,etc)
- 确保可以连接到mysql(权限等)
python manage.py migrate --run-syncdb
- python管理。py——run-syncdb迁移
-
Exclude contentype data with this snippet
将contentype数据排除在此代码段中。
from django.contrib.contenttypes.models import ContentType ContentType.objects.all().delete() quit()
从django.contrib.contenttypes。模型导入内容类型ContentType.objects.all().delete()
-
python manage.py loaddata datadump.json
python管理。py loaddata datadump.json
Hope that will help you!
希望这能对你有所帮助!