django-scheduler的安装:$ python manage.py runserver返回KeyError:u'__ module__' [英] Installation of django-scheduler: $python manage.py runserver returns KeyError: u'__module__'
问题描述
我通过pip安装了django-scheduler( https://github.com/llazzaro/django-scheduler ),然后按照教程中的内容编辑settings.py。当我运行$ python manage.py runserver时,我得到了这个信息:
I installed django-scheduler with pip (https://github.com/llazzaro/django-scheduler) and I edited settings.py as in the tutorial. When I run $python manage.py runserver I got this:
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)和该应用程序。我的项目需要一个日历应用程序,这似乎是最完整的。
I tried to reinstall Python (2.7), Django (1.7) and the app. I need a calendar app to my project and this seems the most complete.
谢谢。
推荐答案
我遇到了同样的问题。事实证明,我安装的python six
版本存在问题。我使用的是六个
版本 1.6.1
,当我升级到版本 1.9.0时
处理了此错误。运行:
I had this same issue. It turned out to be a problem with the version of python's six
I had installed. I was using six
version 1.6.1
, and when I upgraded to version 1.9.0
it took care of this error. Run:
pip-2.7 install --upgrade six
这篇关于django-scheduler的安装:$ python manage.py runserver返回KeyError:u'__ module__'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!