我能够运行我的Google App Engine项目(我正在使用Python Flask开发Web应用程序),但是当我将系统从Ubuntu 12.04升级到14.04时。 App Engine项目在本地系统上没有响应,而在生产环境中运行良好。我还保持我的项目更新将我的源代码放在github上,所以我删除了所有内容,并再次从我的github帐户克隆了一个新的存储库。但是当我运行该项目时,它给了我以下错误,如果有人遇到此错误,请帮助我。
我使用此命令来运行我的项目
$ dev_appserver.py src/
并将此错误作为终端上的输出
WARNING 2015-02-23 06:13:02,341 simple_search_stub.py:1115] Could not read search indexes from /tmp/appengine.practical-now-720.chitrank/search_indexes
INFO 2015-02-23 06:13:02,347 api_server.py:172] Starting API server at: http://localhost:60268
INFO 2015-02-23 06:13:02,368 dispatcher.py:186] Starting module "default" running at: http://localhost:8080
INFO 2015-02-23 06:13:02,369 admin_server.py:118] Starting admin server at: http://localhost:8000
ERROR 2015-02-23 06:13:05,655 wsgi.py:263]
Traceback (most recent call last):
File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/chitrank/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/run.py", line 5, in <module>
import application
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/__init__.py", line 47, in <module>
import urls
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/urls.py", line 10, in <module>
from application import views
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/application/views.py", line 49, in <module>
import requests
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/lib/requests/__init__.py", line 58, in <module>
from . import utils
File "/home/chitrank/Documents/Google_App_Engine/GoogleCloudPlatform/uscore-firstsubmit/uscore/src/lib/requests/utils.py", line 19, in <module>
from netrc import netrc, NetrcParseError
File "/usr/lib/python2.7/netrc.py", line 7, in <module>
import pwd
File "/home/chitrank/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 898, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named pwd
INFO 2015-02-23 06:13:05,710 module.py:718] default: "GET /_ah/warmup HTTP/1.1" 500 -
如果有人解决了这个问题,请帮我解决以下问题。
答案 0 :(得分:8)
在google_appengine/google/appengine/tools/devappserver2/python/sandbox.py
中有_WHITE_LIST_C_MODULES
个列表,并为其添加'pwd'
。
Google实际上是在沙箱中运行。由于生产环境中没有问题,旧的GAE SDK将支持pwd
导入,但他们即将删除它。
答案 1 :(得分:-2)
您使用的是哪种版本的请求?
您能说明如下:
import requests
requests.version
'x.x.x'
$ dpkg -l | grep requests
侧面说明:您使用的请求版本可能有些陈旧,我建议您尽可能升级到2.3.4或最新版本并尝试一下!。
您可以查看以下链接:
[1] https://github.com/kennethreitz/requests/blob/v2.2.1/requests/utils.py#L19