如何将 postgres 关系导入 django 1.8



我在postgres中有一个现有的django数据库,它有几个关系。我在 django postgres 中有一个新模型,我想从现有数据库中导入一些有关系的表。是否需要将旧字段映射到新模型?如何维护关系?有没有一个工具可以帮助这个过程?

谢谢

使用

python manage.py inspectdb

它将从您的旧数据库创建模型。 在这里阅读更多内容:

https://docs.djangoproject.com/en/1.8/howto/legacy-databases/#integrating-django-with-a-legacy-database

最新更新