Django Migrations | Python Last Updated : 03 Jul, 2019 Summarize Suggest changes Share Like Article Like Report Prerequisite: Django Models No such table? - The class defined in product/models.py is the mere idea of what our database is going to look like but it didn't create any table in the database. We can assume class Phone as conceptual schema. Before the creation of any table, if we try to access the table before creation, it will throw an error like this. OperationalError at /admin/product/phone/ no such table: product_phone makemigrations command - Python provides certain commands for user convenience so that without going into details of SQL, a user can interact with the database. Now, we have created the class (conceptual schema of the database), we can use migrate command to create the actual schema in the database. Stop the server using CTRL+C if running and run the following command in the database. python manage.py makemigrations Above command will let the project know that we want to make changes in the database. You will see following quoting that Create model Phone. what does this command do? This command will generate SQL statements that are supposed to be executed if we wish to make changes in the database. If you want to see the generated commands, navigate to product/migrations/0001_initial.py. You will see file content If you try to run the server now using command python manage.py runserver you will see You have 1 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): product. Run 'python manage.py migrate' to apply them. As written in warning, run python manage.py migrate in your terminal. This will result in creation of table in database. Advertise with us Next Article Python | Django Admin Interface A ankush_953 Follow Similar Reads Python | Django Admin Interface Prerequisites: Django Introduction and Installation Creating a ProjectThe Django Admin Interface is one of the most powerful features of the Django framework. It provides a ready-to-use interface for managing project data through models, allowing developers and site administrators to perform Create, 3 min read Django manage.py migrate command | Python According to documentation, Migrations are Djangoâs way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. Theyâre designed to be mostly automatic, but youâll need to know when to make migrations when to run them, and the common problem 2 min read Complete Django History | Python Prerequisite - When to Use Django ? Comparison with other Development Stacks Django was design and developed by Lawrence journal world in 2003 and publicly released under BSD license in July 2005. Currently, DSF (Django Software Foundation) maintains its development and release cycle. Django was rel 2 min read Django Squashing Database Migrations Files Migrations are Django's way of propagating changes we make to our models (adding a field, deleting a model, etc.) into our database schema.Migrations in Django propagate model changes (like adding a field) to our database schema. The key commands are:migrate: Applies and unapplied migrations.makemig 7 min read Django App Model - Python manage.py makemigrations command According to documentation, Migrations are Djangoâs way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. Theyâre designed to be mostly automatic, but youâll need to know when to make migrations, when to run them, and the common proble 2 min read OperationalError in Django In this article first, we explore the problem of the 'django.db.utils.OperationalError' error, Why this error occurs ? and its possible fixes. What is 'django.db.utils.OperationalError'?You may see the following error when running the django project: django.db.utils.OperationalError: no such table : 3 min read Article Tags : Python Web technologies Python Django Practice Tags : python Like