简体   繁体   English

如何使用 django 中的 .db 文件获取数据?

[英]How to use .db file in django for getting data?

I have a.db file from sqLite3.I want to use it in django project.我有一个来自 sqLite3 的 .db 文件。我想在 django 项目中使用它。 With inspectdb, I created model from this db file.使用inspectdb,我从这个db文件创建了model。 But I want to get data from this.db file.但我想从 this.db 文件中获取数据。 Is that possible?那可能吗? And how can I retrieve data from db file?以及如何从 db 文件中检索数据? Thanks.谢谢。

Inspectdb only create model.py,not retrieve data. Inspectdb 只创建 model.py,不检索数据。

  1. create the Django project.创建 Django 项目。
  2. Make migrations with similar schema使用相似架构进行迁移
  3. replace the new DB file with this one.用这个替换新的数据库文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM