[英]manage.py runserver importerror
after running python manage.py runserver 0.0.0.0:8000 运行python manage.py runserver 0.0.0.0:8000后
I get this error message 我收到此错误消息
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
I've checked out /django/contrib/auth/management/ init .py and the get_permission_codename function exists so I can't see why it's not getting imported. 我已经签出了/ django / contrib / auth / management / init .py,并且存在get_permission_codename函数,所以我看不到为什么它没有被导入。
First, make sure you have Django 1.6 or later installed, because that's when get_permission_codename
was added. 首先,请确保已安装Django 1.6或更高版本,因为那是添加
get_permission_codename
时间。
The problem might be with old pyc
files. 问题可能与旧的
pyc
文件有关。 You could get rid of these by uninstalling Django completely then reinstalling. 您可以通过完全卸载Django然后重新安装来摆脱它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.