Open vncsms opened 5 years ago
Probably you firstly should try to import User model not directly but from get_user_model() from django.contrib.auth
Ok, i add django.contrib.auth.models import User
instead from user.models import User
. Now the commands architect partition --module article.models
works. But i cannot add users, because several errors. So i revert my import to from user.models import User
, and now works fine. I actually don't know what is happening, but i think my problem is solved. Thanks
Try to avoid direct User import. Import from django.contrib.auth.models
also not a good way.
But if cannot import with this two ways, how i import my model User?
from django.contrib.auth import get_user_model
User = get_user_model()
The problem is the django.contrib.auth.models import User
and from user.models import User
aren't the same, i have my own user model. And when i use django.contrib.auth
is not giving me my model. I think my error: ImportError: No module named models
it's happening because the conflict between another object that calls user. But in my project this conflict not occur, only when i execute the architect.
I add the partition configuration in my class:
I export the path:
$ export DJANGO_SETTINGS_MODULE=prisvo.settings
But when i execute
architect partition --module article.models
My site works with no problem, my model user work perfectly, my migrations are done without errors. Only here is giving me an error. And if i comment where the import is imported is give another import error with the same model but in another code.