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?

asked Sep 21, 2015 at 11:36
2
  • Give a look to this post stackoverflow.com/questions/24912173/… Commented Sep 21, 2015 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 stackoverflow.com/questions/4092395/…) 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. Commented Sep 21, 2015 at 12:52

2 Answers 2

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

answered Sep 21, 2015 at 12:34
Sign up to request clarification or add additional context in comments.

Comments

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', ...

answered Sep 21, 2015 at 12:14

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.