djangocms KeyError:你&_ 39; __模块__'

时间:2016-05-16 10:14:55

标签: django django-cms

根据此详细信息运行djangocms:doc.django-cms 在做所有的细节,当我想要运行djangocms我得到KeyError: u'__module__'错误

pip freeze的结果是:

cffi==1.6.0
cryptography==1.3.2
dj-database-url==0.4.1
Django==1.6
django-classy-tags==0.7.2
django-cms==3.2.5
django-formtools==1.0
django-i18nurls==0.7
django-mptt==0.8.4
django-sekizai==0.9.0
django-treebeard==4.0.1
djangocms-admin-style==1.1.1
djangocms-installer==0.8.8
enum34==1.1.2
html5lib==0.9999999
idna==2.1
ipaddress==1.0.16
louis==2.6.5
MySQL-python==1.2.5
netsnmp-python==1.0a1
numpy==1.11.0
packaging==16.7
paramiko==2.0.0
pexpect==4.0.1
ply==3.8
ptyprocess==0.5.1
pwquality==1.3.0
pyasn1==0.1.9
pycparser==2.14
pycrypto==2.6.1
pygobject==3.20.0
pyparsing==2.1.4
pytz==2016.4
six==1.10.0
South==1.0.2
team==1.0
Terminator==0.98
Twisted==16.1.1
tzlocal==1.2.2
zope.interface==4.1.3

错误:

Validating models...

Unhandled exception in thread started by <function wrapper at 0xb66ed33c>
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/djang/util/autoreload.py",      
line 93, in wrapper
   fn(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/core/management/command/runserver.py", line 98, in inner_run
    self.validate(display_num_errors=True)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
  File "/usr/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
  File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
  File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
  File "/usr/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
  File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
  File "/usr/lib/python2.7/site-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import *  # nopyflakes
  File "/usr/lib/python2.7/site-packages/cms/models/pagemodel.py", line 35, in <module>
class Page(six.with_metaclass(PageMetaClass, MP_Node)):
  File "/usr/lib/python2.7/site-packages/django/utils/six.py", line 566, in with_metaclass
return meta("NewBase", bases, {})
  File "/usr/lib/python2.7/site-packages/cms/models/metaclasses.py", line 17, in __new__
return super_new(cls, name, bases, attrs)
  File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 78, in __new__
module = attrs.pop('__module__')
KeyError: u'__module__'

我升级了六个应用程序并将django的版本减少到1.6 我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

docs you linked to说它需要Django 1.6.9或更高版本,所以你需要升级。 1.6.X的最终版本是1.6.11:

pip install django==1.6.11

不再支持Django 1.6.X,因此不会收到安全修复程序。您应该尽快将应用程序升级到支持的版本。目前的长期支持版本是1.8.X。