3.5.3 Applying Migrations to Create or Modify a Database

The command to run the code in the migrations files, colloquially called applying a migration, is migrate. If you’ve been following closely, you already used the command in Chapter 1, before we used the runserver command. Calling the command created a default SQLite database, which Django requires to run on a server.

Regardless of whether you already have a database, you will now call migrate again, as in Example 3.33.

Example 3.33: Shell Code

$ ./manage.py migrate

If you don’t already have a database, Django will create one named db.sqlite3, as specified on line 64 of /suorganizer/settings.py. Django will also produce the output shown in Example 3.34.

Example 3.34: Shell Code

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.