Creating a Database
Django includes several applications by default (e.g., the admin program and user management and authentication). Some of these applications make use of at least one database table, so we need to create tables in the project database before we can use them. To do this, change into the myclub_site
folder created in the last step (type cd myclub_site
at the command prompt) and run the following command:
python manage.py migrate
The migrate command creates a new SQLite database and any necessary database tables, according to the settings file created by the startproject
command (more on the settings file later). If all goes to plan, you’ll see a message for each migration it applies:
(env_myclub) ...\myclub_site>python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
# several more migrations (not shown)
当前内容版权归 djangobook 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 djangobook .