pythondjangopycharm

python manage.py makemigrations : No changes detected


I am working on a project using django and I am using pycharm software. In my 'store' directory i have a python package called 'models' in which there are two python files :- init.py and product.py . The problem i am getting is that I cannot create table using the command even when I am importing the 'Product' class from product module in init.py file. Even both the modules are also in the same package. Here is the code of the product.py file:-

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/')

And here is the code of init.py file:-

from .product import Product

But when i am running the command on terminal i am getting this error:-

(venv) C:\Users\Admin\PycharmProjects\SMart>python manage.py makemigrations
No changes detected

Solution

  • You must put the name of your app <store> into the list of INSTALLED_APPS inside your settings.