File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Library/Python/2.7/site-packages/dj_static.py", line 83, in __call__
return self.application(environ, start_response)
File "/Library/Python/2.7/site-packages/django/core/handlers/wsgi.py", line 255, in __call__
response = self.get_response(request)
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 178, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 220, in handle_uncaught_exception
if resolver.urlconf_module is None:
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/WillRedington/Desktop/Django Projects/propadev/propvocab/urls.py", line 3, in <module>
from rest_framework import routers
File "/Library/Python/2.7/site-packages/rest_framework/routers.py", line 23, in <module>
from rest_framework import views
File "/Library/Python/2.7/site-packages/rest_framework/views.py", line 11, in <module>
from rest_framework.compat import HttpResponseBase, View
File "/Library/Python/2.7/site-packages/rest_framework/compat.py", line 13, in <module>
from django.utils.six.moves.urllib import parse as urlparse
ImportError: No module named urllib
服务器错误消息:[17 / Dec / 2014 16:26:45]“ GET / HTTP / 1.1” 500 59
这正在检查python是否返回模块:
>>> import django.utils.six.moves
>>> import django.utils.six.moves.urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named urllib
>>>
我当前的python版本是2.7.2,Django是1.5.1,其余框架在2.7 site-package中。我已经尝试过多次卸载并重新安装Django并得到相同的错误。这是在Mac OS X 10.9.5上运行的,请帮助我,我已经参加了5个小时。
似乎是一个依赖错误。也许您降级了django,或在不控制依赖项的情况下随机安装了其余框架包。
django == 1.5.1中尚不存在django.utils.six.moves.urllib。例如,您可以尝试将django升级到1.5.7。然后,此导入将起作用。但是,我无法从这里告诉您其他问题。如果在此处发布点子冻结的输出,可能会更容易帮助。
您不在虚拟环境中工作,这对依赖关系很危险。最好是制作一个virtualenv,然后使用pip安装软件包,并注意相关性。然后运行:
pip freeze > requirements.txt
并在以后像这样使用该文件:
pip install -r requirements.txt
并在安装,更新或删除软件包时相应地编辑文件。
可能感兴趣的是:通常,多次卸载并重新安装同一软件包永远不会起作用;如果它一次不起作用,那么第二次也将不起作用。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。