Want to use my existing mysql database with django

前端 未结 2 1848
执念已碎
执念已碎 2020-12-28 21:44

I have created a django project and now rendering templates. I have a mysql database already with loads of tables and data.

From what i saw in the tutorials, the mo

2条回答
  •  感动是毒
    2020-12-28 22:07

    inspectdb works fine now. (Django 1.7.1) Simply running manage.py inspectdb will create classes for all tables in database and display on console.

     $ python manage.py inspectdb
    

    Save this as a file by using standard Unix output redirection:

     $ python manage.py inspectdb > models.py
    

    Reference

提交回复
热议问题