python manage.py runserver 0.0.0.0:8000
我收到此错误消息
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x7fefc10b9190>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import * # nopyflakes
File "/usr/local/lib/python2.7/dist-packages/cms/models/pagemodel.py", line 6, in <module>
from django.contrib.auth import get_permission_codename
ImportError: cannot import name get_permission_codename
我已经查看了/django/contrib/auth/management/init.py 并且get_permission_codename函数存在,所以我看不出它为什么没有导入。
答案 0 :(得分:0)
首先,确保安装了Django 1.6或更高版本,因为添加get_permission_codename
时就是这样。
问题可能出在旧的pyc
文件中。你可以通过完全卸载Django然后重新安装来摆脱这些。