非常具体的东西。我在亚马逊上运行Bitnami Django堆栈云虚拟机。在两个不同的"常规"机器,我可以通过运行requests
来安装sudo pip install requests
,但似乎Bitname使用它自己的特定结构,并且在安装requests
时会出现问题。它也可能与问题#2028有关,但很久以前就修复过了。
我有以下追溯:
Environment:
Request Method: GET
Request URL: http://54.94.226.137/
Django Version: 1.7.7
Python Version: 2.7.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'vz_base',
'vz_api',
'vz_admin',
'vz_user')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
98. resolver_match = resolver.resolve(request.path_info)
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve
343. for pattern in self.url_patterns:
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns
372. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/opt/bitnami/python/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module
366. self._urlconf_module = import_module(self.urlconf_name)
File "/opt/bitnami/python/lib/python2.7/importlib/__init__.py" in import_module
37. __import__(name)
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/ProjetoVigZul/urls.py" in <module>
5. from vz_api import urls as api_urls
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/urls.py" in <module>
8. from vz_api import views
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/views.py" in <module>
14. from vz_api.dguard import DGuardManager, DGuardIntegrationException
File "/opt/bitnami/apps/django/django_projects/ProjetoVigZul/vz_api/dguard.py" in <module>
5. import requests, json
File "/opt/bitnami/python/lib/python2.7/site-packages/requests/__init__.py" in <module>
58. from . import utils
File "/opt/bitnami/python/lib/python2.7/site-packages/requests/utils.py" in <module>
25. from . import certs
Exception Type: ImportError at /
Exception Value: cannot import name certs
如果有人有兴趣,网站会在http://54.94.226.137/上线。
答案 0 :(得分:3)
sudo pip install --upgrade requests
为我解决了这个问题