楼主:
extron (extron)
2015-10-20 14:44:50我在setting.py成功的将django连上我已经存在的MySql
在网络上看到的教学(包含官网的tutorial)
都先从create date -> save -> retrieve
但若我已经有现成的资料了 请问我怎么透过django orm读取数据库?
假设我已经有一个table Fruit 并且含有很多水果的资料
于是我在 models.py 里面
class Fruit(models.Model)
name = ...
color = ...
每个type都按照现有数据库里面Fruit的type去做宣告
也执行了
makemigrations 和
migrate
all_fruit = Fruit.objects.all()
print(all_fruit) 却传回 [] <