反向工程mysql数据库创建django应用程序 [英] reverse engineer mysql database to create django app

查看:125
本文介绍了反向工程mysql数据库创建django应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上想要使用由php应用程序(codeigniter框架)创建和使用的现有mysql数据库结构,并将其反向工程到django应用程序。有没有办法这样做?南迁可能吗?

解决方案

创建项目,并将您的设置指向您的数据库



然后运行



./ manage.py inspectdb



这将打印出您指向的DB的python模型文件



您可以通过执行类似于



./ manage.py inspectdb> models.py



然后,您可以将文件移动到最合适的位置,并根据需要进行编辑。


I basically want to take an existing mysql database structure created and used by a php app (codeigniter framework) and reverse engineer it to a django app. is there some tool to do this? south migrations maybe?

解决方案

Create a project, and point your settings @ your database

Then run

./manage.py inspectdb

This will print out a python models file for the DB you're pointing at

You can output this to a file by doing something like

./manage.py inspectdb > models.py

And then you can move the file to the most suitable location, and edit it as needed.

这篇关于反向工程mysql数据库创建django应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆