Solve Django makemigrations Error – No changes detected

makemigrations Error – No changes detected is a Python error which occurs when you’re misusing makemigrations.

In this article I am going to solve the error while I try explaining why the error is popping up in the first place, I will also introduce some solutions which worked for other developers and we will see if those solutions can solve the error in your unique situation.

Context of the Error : makemigrations Error – No changes detected

The problem happens when you misuse makemigrations in python.

The error message should look like the error in the example bellow.

                                                                       #
No changes detected
                                                                       #

Bellow are the solutions which worked for me and will help you to successfully get rid of the error.

Solution 1 : use a relative import

The easiest solution to the issue is to use a relative import.

First, create a directory, choose a name for it, I am going to call it workspace.

Inside the directory create a module, I am going to call it rivarr.py

Navigate to

                                                                       #
/workspace/__init__.py
                                                                       #

Edit the file and add the line of code bellow at the beginning.

                                                                       #
from .workspace import rivarr 
                                                                       #

That is it, this should be enough to fix your problem. If this did not do it, please try the solution bellow.

Solution 2 : edit settings.py

The second solution is edit the settings.py file.

You should make sure to add the name of your app to INSTALLED_APPS.

It will look similar to this.

                                                                       #
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'blog',
]
                                                                       #

You should add the name of your script to that list. In order to avoid running the migration.

Finally, run the following command.

                                                                       #
./manage.py makemigrations blog
                                                                       #

The error above was hard to deal with, I spent hours looking for a proper solution or set of solutions.

Summing-up

It seems that there are only two possible solutions to the problem, upgrading to Python 3.6 worked for me and for most people, the second solution works for people who want to keep the Python version as it is.

I can not find any other solution to the problem guys, I tried my best, I hope the above solutions worked for you, cheers, keep coding. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/