安装django-scheduler:$ python manage.py runserver返回KeyError:你'__ module __'

时间:2015-06-08 19:29:44

标签: django module calendar schedule keyerror

我用pip(https://github.com/llazzaro/django-scheduler)安装了django-scheduler,并在教程中编辑了settings.py。当我运行$ python manage.py runserver时,我得到了这个:

python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/local/lib/python2.7/dist-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 "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/__init__.py", line 1, in <module>
    from schedule.models.calendars import *
  File "/usr/local/lib/python2.7/dist-packages/django_scheduler-0.7.5-py2.7.egg/schedule/models/calendars.py", line 110, in <module>
    class Calendar(with_metaclass(ModelBase, *get_model_bases())):
  File "/usr/lib/python2.7/dist-packages/six.py", line 617, in with_metaclass
    return meta("NewBase", bases, {})
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 71, in __new__
    module = attrs.pop('__module__')
KeyError: u'__module__'

我尝试重新安装Python(2.7),Django(1.7)和应用程序。我需要一个日历应用程序到我的项目,这似乎是最完整的。

感谢。

2 个答案:

答案 0 :(得分:5)

我有同样的问题。事实证明,我安装的python six版本存在问题。我使用的是six版本1.6.1,当我升级到版本1.9.0时,它会处理此错误。运行:

pip-2.7 install --upgrade six

答案 1 :(得分:0)

run this script using djago-getversions.py

import pip
 installed_packages = pip.get_installed_distributions()
 installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
 for i in installed_packages])
  print(installed_packages_list)
----------------------------------------------------

check your django installed versions

after that compare or reinstall like these versions:

please check your this version:

[
   'adium-theme-ubuntu==0.3.4',
   'apt-xapian-index==0.45',
   'chardet==2.0.1',
   'colorama==0.2.5',
   'command-not-found==0.3',
   'debtagshw==0.1',
   'defer==1.0.6',
   'dirspec==13.10',
   'django-classy-tags==0.6.1',
   'django-cms==3.0.12',
   'django-mptt==0.6.1',
   'django-sekizai==0.8.1',
   'django-treebeard==3.0',
   'django==1.6.1',
   'djangocms-admin-style==0.2.5',
   'djangocms-link==1.5',
   'djangocms-snippet==1.4',
   'djangocms-text-ckeditor==2.4.3',
   'dnspython==1.11.1',
   'duplicity==0.6.23',
   'html5lib==0.999',
   'httplib2==0.8',
   'iniparse==0.4',
   'lockfile==0.8',
   'lxml==3.3.3',
   'mercurial==2.8.2',
   'mysql-connector-python==1.1.6',
   'mysql-python==1.2.3',
   'mysql-utilities==1.3.5',
   'oauthlib==0.6.1',
   'oneconf==0.3.7',
   'pam==0.4.2',
   'paramiko==1.10.1',
   'pexpect==3.1',
   'pillow==2.3.0',
   'pip==7.1.0',
   'piston-mini-client==0.7.5',
   'pycrypto==2.6.1',
   'pycups==1.9.66',
   'pycurl==7.19.3',
   'pygments==1.6',
   'pygobject==3.12.0',
   'pyopenssl==0.13',
   'pyserial==2.6',
   'pysmbc==1.0.14.1',
   'pysqlite==2.6.3',
   'python-apt==0.9.3.5ubuntu1',
   'python-debian==0.1.21-nmu2ubuntu2',
   'pyxdg==0.25',
   'reportlab==3.0',
   'requests==2.2.1',
   'sessioninstaller==0.0.0',
   'setuptools==3.3',
   'six==1.5.2',
   'software-center-aptd-plugins==0.0.0',
   'south==1.0.2',
   'system-service==0.1.6',
   'tortoisehg==2.10',
   'twisted-core==13.2.0',
   'twisted-web==13.2.0',
   'unity-lens-photos==1.0',
   'urllib3==1.7.1',
   'version==0.1.1',
   'virtualenv==13.0.1',
   'wheel==0.24.0',
   'wxpython-common==2.8.12.1',
   'wxpython==2.8.12.1',
   'xdiagnose==3.6.3build2',
   'youtube-dl==2015.7.7',
   'zope.interface==4.0.5'
]