0

I am outsourcing my models into packages in order to have a better overview. So the models.py of my app main looks like

from django.db import models
from models import *

And the actual models are in models/user.py, ...

So when I go back to prepare a migration:

python manage.py makemigrations main

Django won't detect any changes. Why?

Saphire
  • 1,812
  • 1
  • 18
  • 34
  • Give a look to this post http://stackoverflow.com/questions/24912173/django-1-7-makemigrations-not-detecting-changes – coder3521 Sep 21 '15 at 11:43
  • You have a models.py and a models directory in your main directory? Aren't you asking for confusion on which python will import? (See http://stackoverflow.com/questions/4092395/python-import-precedence-packages-or-modules) I would suggest renaming the directory to mymodels or similar. This may not actually be your issue, but it still makes my python-sense tingle. – Foon Sep 21 '15 at 12:52

2 Answers2

0

Django looks into 'appname/models.py'. If you want this structure, you can use 'appname/user/models.py' and in INSTALLED_APPS 'appname.user', but it's better to use flat design: 'appname/models.py', 'user/models.py', ...

Ondrej Sika
  • 1,715
  • 2
  • 11
  • 12
0

I had the same problem with migrating my models. so i changed the import methodology and instead of

from models import *

i tried this

from models.user import User, Device, ...

and it worked

Lal
  • 1,599
  • 15
  • 18