Chinaunix首页 | 论坛 | 博客
  • 博客访问: 782338
  • 博文数量: 253
  • 博客积分: 6891
  • 博客等级: 准将
  • 技术积分: 2502
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-03 11:01
文章分类

全部博文(253)

文章存档

2016年(4)

2013年(3)

2012年(32)

2011年(184)

2010年(30)

分类: 系统运维

2011-09-20 09:27:05

Auto-generate the models

Django comes with a utility called that can create models by introspecting an existing database. You can view the output by running this command:

python manage.py inspectdb

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

python manage.py inspectdb > models.py

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.

Install the core Django tables

Next, run the command to install any extra needed database records such as admin permissions and content types:

python manage.py syncdb
阅读(804) | 评论(0) | 转发(0) |
0

上一篇:render_to_response

下一篇:traceback

给主人留下些什么吧!~~