2

Im calling migrate on my manage.py but it is not working.

I am running Ubuntu 18.04

here is the error:"

Traceback (most recent call last):
  File "/snap/pycharm-professional/68/helpers/pycharm/django_manage.py", line 52, in <module>
    run_command()
  File "/snap/pycharm-professional/68/helpers/pycharm/django_manage.py", line 46, in run_command
    run_module(manage_file, None, '__main__', True)
  File "/usr/lib/python2.7/runpy.py", line 188, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/jre/PycharmProjects/autda_emp/manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/filer/models/__init__.py", line 3, in <module>
    from .clipboardmodels import *  # flake8: noqa
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 9, in <module>
    from . import filemodels
  File "/home/jre/PycharmProjects/autda_emp/venv/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 16, in <module>
    from . import mixins
ImportError: cannot import name mixins

here is my pip freeze:

Django==1.11.13
django-filer==1.3.1
django-js-asset==1.1.0
django-mixins==0.0.10
django-mptt==0.8.7
django-polymorphic==1.3.1
django-suit==0.3a3
easy-thumbnails==2.5
Pillow==5.1.0
psycopg2==2.6.1
pytz==2018.4
Unidecode==0.4.21

I have not done much aside of creating a project and installing the packages following directions in the documentation.

if needed here is my installed apps list

INSTALLED_APPS = [

    'autokada_emp.apps.MyDjangoSuitConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'mixins',
    'easy_thumbnails',
    'filer',
    'mptt',

]

I do not have much experience so all help would be appreciated

here is the projects structure as asked:

├── autda_emp
│   ├── apps.py
│   ├── apps.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── templatetags
│   │   └── future.py
│   ├── urls.py
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
├── manage.py
├── templates
└── venv
    ├── bin [18 entries exceeds filelimit, not opening dir]
    ├── include
    │   └── python2.7 -> /usr/include/python2.7
    ├── lib
    │   └── python2.7 [48 entries exceeds filelimit, not opening dir]
    ├── local
    │   ├── bin -> /home/jre/PycharmProjects/autda_emp/venv/bin
    │   ├── include -> /home/jre/PycharmProjects/autada_emp/venv/include
    │   └── lib -> /home/jre/PycharmProjects/autda_emp/venv/lib
    └── pip-selfcheck.json

After extensive testing i found that error starts after I install django-suit

HellOfACode
  • 1,675
  • 3
  • 18
  • 38
  • Perhaps there's something wrong with your `django-filer` installation. Try reinstalling it: `pip uninstall django-filer` then `pip install django-filer==1.3.1`. – Alasdair Jun 29 '18 at 09:28
  • @Alasdair i tried it with no luck. – HellOfACode Jun 29 '18 at 13:55
  • 2
    There is a couple possible solutions here https://stackoverflow.com/questions/17949389/django-filer-importerror-cannot-import-name-mixins – trinchet Jul 02 '18 at 14:16
  • 1
    Seems like you may have two conflicting packages `django-mixins==0.0.10` and `django-filer==1.3.1` remove `django-mixins` and then try – Tarun Lalwani Jul 03 '18 at 05:43
  • @TarunLalwani sad to say that `django-mixins` was added post error in a try to fix the error. As it did not help it has been removed. – HellOfACode Jul 03 '18 at 08:42
  • Do you have a minimal reproducible git repo? – Tarun Lalwani Jul 03 '18 at 08:51
  • This error message usually indicates a circular import somewhere. Do you have any `import` statements in your `settings.py` file? – Håken Lid Jul 03 '18 at 15:58
  • @TarunLalwani I created a git repo. https://github.com/janisroze/autda Note that i changed sensitive data in some places so might have some glitches. – HellOfACode Jul 04 '18 at 21:17
  • The problem has to be the environment. The repo seems very non-standard... two venvs... multiple setting.py... no apps.. no templates. If you've done nothing except create the project and install django-filler, maybe just delete everything and start over? Have you created a new blank project (without django-filler) in your current environment successfully? – Matthew Weber Jul 05 '18 at 14:57

2 Answers2

0

I'd guess that the problem is caused by the fact you have django-polymorphic==1.3.1.

The question linked to by @trinchet in the comments has this answer: https://stackoverflow.com/a/24139080/1600612, which says that django-polymorphic can cause the problem you have.

And filer's docs mention this:

for Django >=1.11 use django-polymorphic >=2.0

Yet you have Django==1.11.13 and django-polymorphic==1.3.1 according to your pip freeze output.

dvk
  • 1,420
  • 10
  • 13
0

I faced the same issue.

Install polymorphic with the below-given command and you will not face this error anymore.

pip3 django-polymorphic ==2.0
Ali
  • 2,702
  • 3
  • 32
  • 54