migrations: "no changes detected"

219 views
Skip to first unread message

Delvin Alexander

unread,
Feb 7, 2022, 11:41:54 PM2/7/22
to Django users
I am trying to run migrations so that i can create a table, but when I type out, "python manage.py makemigrations"
it returns this: "no changes detected"

would anyone know the reason for this?

RANGA BHARATH JINKA

unread,
Feb 8, 2022, 12:37:55 AM2/8/22
to django...@googlegroups.com
Hi,

I think you forgot to add the app name in settings file. Please add the app names in installed apps. Then it will find out the models.

All the best


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/639770ea-db24-469a-a123-6f4cb2af3036n%40googlegroups.com.

Armaan Alam

unread,
Feb 8, 2022, 12:42:22 AM2/8/22
to django...@googlegroups.com
delete database and migration then again run makemigrations and migrate

Fajri Fath

unread,
Feb 8, 2022, 9:12:42 AM2/8/22
to django...@googlegroups.com
You must delete your folder migrations in your app.

Example:

rm -rf myapplication/migrations

And

rm db.sqlite3

and run

python manage.py makemigrations

--

Feroz Ahmed

unread,
Feb 8, 2022, 10:15:18 AM2/8/22
to django...@googlegroups.com

checkout u not forgot to add app in installed app in settings.py

if still the issue , forward your settings.py

 

best practice , try to solve the issue from current configuration

 

Regards

--

Yeboah Dominic

unread,
Feb 8, 2022, 11:13:13 AM2/8/22
to django...@googlegroups.com
I think this has to be like you are trying to add some model whose field is not recognizable I have the same issue when using geodjango.
If you delete the DB.sqlite3 sometimes it won't work or even deleting the migrations won't also work.
If that happens just run,
1. python manage.py makeigrations
2. python manage.py sqlmigrate app_name, 0001_initial

this will generate the schemas of the app models just copy the model you want schemas and open your SQLite DB browser if you don't have you can download one if you are using Postgres or any DB just open it and paste the schema there to create that new schema in your DB for you then you are done.

Mr. Aryan Sharma 4-Year B.Tech. Computer Science and Engineering

unread,
Feb 8, 2022, 11:31:41 AM2/8/22
to django...@googlegroups.com
Happens sometimes.  Try deleting your database file . Start with a fresh one 

--

Delvin Alexander

unread,
Feb 8, 2022, 10:27:57 PM2/8/22
to django...@googlegroups.com
here is a list of my installed apps:

i added the blog.apps but still nothing.


INSTALLED_APPS = [
    'blog.apps.BlogConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',



ramadhan ngallen

unread,
Feb 8, 2022, 10:33:02 PM2/8/22
to 'Maryam Yousaf' via Django users
On your app(blog) on the module(folder) migrations,   make sure there is a file named   __init__.py


You can share app structure too

Delvin Alexander

unread,
Feb 8, 2022, 11:06:35 PM2/8/22
to django...@googlegroups.com
there is! but will this have something to do with it?
- "from django.contrib.auth.models import User"

Rite now the error is displaying this:
Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

ramadhan ngallen

unread,
Feb 8, 2022, 11:14:57 PM2/8/22
to 'Maryam Yousaf' via Django users
Your apps should be below django default apps
I.e below static files


On users you can

from django.contrib.auth import get_user_model

Then initiate it as

User = get_user_model()

To use it
E.g

my_users = User.objects.all()

ramadhan ngallen

unread,
Feb 8, 2022, 11:16:29 PM2/8/22
to 'Maryam Yousaf' via Django users
Share project structure as an image and details project settings(settings.py)

frank maduka

unread,
Feb 9, 2022, 8:51:27 AM2/9/22
to django...@googlegroups.com
Make sure that You have registered you App you created and used it's models. Py to create database tables as well as registering models to the admin.py

Dev femibadmus

unread,
Feb 16, 2022, 3:30:40 AM2/16/22
to django...@googlegroups.com
I have and solve this allot, after adding to ur model myapp run the following:

>> python manage.py makemigrations myapp

>> python manage.py migrate myapp num
where num is the new migrations made u can see this when u open myapp/migrations the new file 000(n) is the num


If this doesn't work try deleting the cache which is the pycache folder in myapp/pycache


If this still doesn't work delete your migrations folder and run again


If this still doesn't work delete all migrations in ur project.


No way it won't work, now your project run 💯


**Reason not makemigrations create new file**

Since u developing the project u can decide to switch between the new model u added and the old one without touching the models file by just >>python manage.py migrate 000(n) the one that contains model u wants.

Reply all
Reply to author
Forward
0 new messages