0

我知道有很多 blobstore 问题,但我已经回到最基本的情况,我被困住了!

从长远来看,我在 Google App Engine 和 Google Cloud SQL 上使用纯 Django,我想将文件上传到 Blobstore(但我无法上传文件)。

我正在尝试从 Google 的 Blobstore 概述(https://developers.google.com/appengine/docs/python/blobstore/overview)运行以下示例

from google.appengine.ext import blobstore
upload_url = blobstore.create_upload_url('/upload')

但我得到以下信息:

$ python
Python 2.7.2+ (default, Jul 20 2012, 22:15:08) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<snip>/google_appengine_1.7.6/google/appengine/api/blobstore/blobstore.py", line 270, in create_upload_url
gs_bucket_name=gs_bucket_name)
File "<snip>/google_appengine_1.7.6/google/appengine/api/blobstore/blobstore.py", line 334, in create_upload_url_async
_get_result_hook, lambda rpc: rpc.response.url())
File "<snip>/google_appengine_1.7.6/google/appengine/api/blobstore/blobstore.py", line 223, in _make_async_call
rpc = create_rpc()
File "<snip>/google_appengine_1.7.6/google/appengine/api/blobstore/blobstore.py", line 217, in create_rpc
return apiproxy_stub_map.UserRPC('blobstore', deadline, callback)
File "<snip>/google_appengine_1.7.6/google/appengine/api/apiproxy_stub_map.py", line 405, in __init__
self.__rpc = CreateRPC(service, stubmap)
File "<snip>/google_appengine_1.7.6/google/appengine/api/apiproxy_stub_map.py", line 67, in CreateRPC
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "blobstore"

我已经回到最基本的情况:Google App Engine SDK 1.7.6(目前最新)和 Python 2.7.2。

我的路径是这样的:

>>> from pprint import pprint as p
>>> p(sys.path)
['',
'<snip>/google_appengine_1.7.6',
'<snip>/google_appengine_1.7.6/lib',
'<snip>/google_appengine_1.7.6/lib/yaml-3.10',
'<snip>/google_appengine_1.7.6/lib/django-1.4',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7']

有趣的是,如果我只在路径中使用基本 GAE 目录尝试此操作,我会得到:

ImportError: No module named yaml

Could this indicate I have something misconfigured in the SDK?

I appreciate anything you can offer!

4

1 回答 1

2

it looks like you are trying this from a plain python prompt.

You have some serious work ahead of you to get this to work (ie probably won't get it to work if your new to appengine, I have been using appengine since it came out and I wouldn't bother trying ;-).

You should be using the remote_api_shell if you want to use a python shell, and be connected to a server (dev or prod appengine) and your just exploring.

The code fragments in the docs you refer to are for code to be run by app engine app, either under the dev server or in production.

于 2013-03-31T00:13:22.600 回答