Django Tutorial : Creating Migrations

February 27, 2019 by admin

In This Article you will learn how you can create migrations in Django

, at this stage we are assuming that you have already created the models , you can follow tutorial about Django Tutorial : Creating Django Models (

With the model created, the first thing you need to do is create a migration for it, migration will create your database tables,You can do this with the following command in pycharm/terminal:

python makemigrations

This creates the migrations file that instructs Django on how to create the database tables for the models defined in your application.

As you will also see, the migrations directory now contains a new file: in project folder.

Next is Applying Migrations

You have now created the migration, but to actually make any changes in the database, you have to apply it with the management command migrate.

In Terminal run this command:

 $ python migrate

Now there are multiple tables. Their names give you an idea of their purpose.

Next >> Django Tutorial : Changing Models

Leave a Reply

Your email address will not be published. Required fields are marked *