PracticalDjangoProjects 笔记二

在syncdb的时候,Django都做了些什么?

ADMONITION: WHAT GOES ON DURING SYNCDB

When you run manage.py syncdb, Django actually does several things in order, and the output on your screen shows each step.
First, Django looks in each application module listed in INSTALLED_APPS and finds the data models. These are Python classes that define the different types of data the application uses, and Django knows how to automatically generate appropriate CREATE TABLE SQL statements from them.

Once the database tables have been created, Django looks for, and runs, any application-specific initialization code for each application. In this case, django.contrib.auth includes code that prompts you to create a user account.

Finally, Django finishes the database setup and installs any initial data you’ve provided. The default set of bundled applications doesn’t use this feature, but later on you’ll see how to supply an initial data file that can kick-start an application by giving it data to work with right away. You won't be providing any initial data with this application, but some of Django's bundled applications do provide data which will be inserted into the database when installed.
posted @ 2009-12-16 16:09  小楼  阅读(262)  评论(0编辑  收藏  举报