The existing database files generated models in Django

Django introducing external database is quite easy, the following steps:

Create a project, modify seting file, set the database name and connection type you want to connect in setting inside, addresses and the like, and when you create a new project consistent 
run the following code can be automatically generated models model file 
Python manage.py inspectdb 
so that you can command in the console line to see the model of the database file

To import files to the app in the model 
to create an app 
django-admin.py startapp app 
python manage.py inspectdb > app/models.py 
the ok model file already generated good. The following work is the same as before the

Guess you like

Origin www.cnblogs.com/bufufan/p/10961151.html