分类: 系统运维
2011-09-20 09:27:05
Django comes with a utility called that can create models by introspecting an existing database. You can view the output by running this command:
Save this as a file by using standard Unix output redirection:
This feature is meant as a shortcut, not as definitive model generation. See the documentation of inspectdb for more information.
Once you've cleaned up your models, name the file models.py and put it in the Python package that holds your app. Then add the app to your setting.
Next, run the command to install any extra needed database records such as admin permissions and content types: