Dharmendra Kakde
Dharmendra Kakde

Reputation: 90

makemigrations shows No changes detected

I totally beginner in django. I create one model which is in models folder and run python manage.py makemigrations still its show No changes detected

enter image description here

product.py

from django.db import models

class Product(models.Model):

name = models.CharField(max_length=50)
price = models.IntegerField(default=0)
description = models.CharField(max_length=200, default='')
image = models.ImageField(upload_to="products/")

init.py (models/init.py)

from .product import Product

Thanks in advance

Upvotes: 0

Views: 807

Answers (1)

B. Sebastiano
B. Sebastiano

Reputation: 42

First you have to create the database with python manage.py migrate. If you have already created your models before doing this step there is no need to do makemigrations. You have to use makemigrations only to collect the new changes and next apply this changes with python manage.py migrate.

  1. Create initialize your DB with python manage.py migrate.
  2. If there are changes collect them with python manage.py makemigrations.
  3. Apply changes to the DB with python manage.py migrate again.

Upvotes: 0

Related Questions