Django REST 框架 + Django 管理数据保存
我无法将其余 API 数据保存到另一个 Django 项目中。
如何将另一个 REST API 数据填充到我的 Django 管理数据库?
I am not able to save my rest API data to my another Django Project.
How I can populate another rest API data to my Django admin database ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据存储在数据库中,因此我假设您想要将数据传输到新数据库。
您可以通过以下方式进行操作。
首先清除您的新数据库 - (这里 new 是您的数据库的名称,它是默认的,但您可以在 settings.py 文件中查找它并使用该名称)
python管理.py刷新--database=new
导出数据从旧数据库到 json 文件
python Manage.py dumpdata>data.json
将数据加载到新数据库中
python Manage.py loaddata data.json --database=new
您将旧数据库中的数据存储在新项目数据库中。
The data is stored in the database so I assume you want to transfer data to your new database.
You can do it in the following way.
First clear your new database - (here new is the name of your database, it is default but you can look it up in settings.py file and use that name)
python manage.py flush --database=new
Export data from the old Database to a json file
python manage.py dumpdata>data.json
Load Data into the new Database
python manage.py loaddata data.json --database=new
You have the data in your new project database from your old database.