GAE无法在virtualenv中导入Web.py模块

时间:2012-10-03 09:10:50

标签: google-app-engine virtualenv web.py virtualenvwrapper

我正在尝试在virtualenv中设置一个Web.py(0.37)项目,以便在Google App Engine(1.7.2)上运行,但我从应用程序服务器获得ImportError: No module named web

我已经从virtualenv中使用python setup.py install安装了web.py并且可以确认它已正确安装,因为我可以从python解释器导入它。

我的实际GAE文件夹不在virtualenv中,但链接如下:

ln -s ~/Development/google_appengine $VIRTUAL_ENV/google_appengine

并添加到$VIRTUAL_ENV/lib/python2.7/site-packages/gae.pth

中的python路径中

我必须要有一个额外的步骤,以下是错误信息:

    ERROR    2012-10-03 09:03:17,442 wsgi.py:203] 
Traceback (most recent call last):
  File "/home/sett/Development/google_appengine/google/appengine/runtime/wsgi.py", line 195, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/home/sett/Development/google_appengine/google/appengine/runtime/wsgi.py", line 239, in _LoadHandler
    handler = __import__(path[0])
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 719, in Decorate
    return func(self, *args, **kwargs)
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1923, in load_module
    return self.FindAndLoadModule(submodule, fullname, search_path)
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 719, in Decorate
    return func(self, *args, **kwargs)
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1787, in FindAndLoadModule
    description)
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 719, in Decorate
    return func(self, *args, **kwargs)
  File "/home/sett/Development/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 1730, in LoadModuleRestricted
    description)
  File "/home/sett/wip/rigmarolesoup/main.py", line 1, in <module>
    import web
ImportError: No module named web

1 个答案:

答案 0 :(得分:2)

App引擎不允许您从site-packages导入第三方模块;您必须将web.py复制到您的app目录中。