我试图从我的应用程序目录中使用命令dev_appserver.py ./
,但它抛出以下错误。在
ERROR 2016-01-04 04:47:51,421 wsgi.py:263]
Traceback (most recent call last):
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/Users/Joshua/Scripts/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/Users/Joshua/Projects/inkren/skritter-api/main.py", line 2, in <module>
from gcloud import datastore
ImportError: No module named gcloud
我运行的是一个安装了gcloud的virtualenv,还安装了gcloud sdk和适当的python组件。gcloud库是在我运行python ./main.py
时找到的。在
我想做的是能够在浏览器中本地运行我的代码。有没有办法让dev_appserver.py
识别gcloud库?在
使用gcloud的python开发服务器仍然是个问题吗?我正在从终端成功地使用
dev_appserver.py
。See reference。在或许install和{a3}指令自一年前以来已经有所改进。我相信安装程序会把文件_应用服务器.py,在您的系统路径中,甚至在Windows上,因此可以从终端访问它。在
我做了一些研究,所以。。。好吧,这就是你要做的。在
深呼吸
转到这位先生的GitHub页面,并以zip格式下载包。https://github.com/dhermes/test-gcloud-on-gae
现在,您需要从他的文件夹中添加一些文件夹/文件到您的文件夹中,以使
gcloud
正常工作。在1)打开
application
文件夹,将vendor
文件夹放入根目录。此文件夹包含gcloud
包以及其他许多包。如果你愿意,你可以删除其他的。在2)将
appengine_config.py
也添加到根目录中。这个文件告诉app engine你的第三方软件包在哪里。在3)将
darth.py
也添加到根目录中。这只是一个帮助文件。在事实上,这应该可以。这位先生写了一些使用appengine的第三方应用程序的脚本,它们非常有用。让我知道,如果你的进口工作后,这样做!在
我在本地进行了测试,效果非常好。基本上,任何第三方python包都可以使用appengine,只要其中没有其他语言,比如
C
。在相关问题 更多 >
编程相关推荐