2

我打电话migrate给我的 manage.py 但它不起作用。

我正在运行 Ubuntu 18.04

这是错误:”

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

这是我的点冻结:

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

除了按照文档中的说明创建项目和安装软件包之外,我并没有做太多事情。

如果需要,这是我的installed apps清单

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

]

我没有太多经验,所以所有帮助将不胜感激

这是所要求的项目结构:

├── 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

经过大量测试后,我发现安装后错误开始django-suit

4

2 回答 2

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.

于 2018-07-09T09:21:06.217 回答
0

我遇到了同样的问题。

使用以下给出的命令安装polymorphic,您将不再遇到此错误。

pip3 django-polymorphic ==2.0
于 2018-12-13T04:09:10.443 回答