python - Data migration using blobstore API fails -


I am migrating GCS files from S3 using the Blobstore API. I've created a South Data Migration Script to update the metadata for files: import google.appengine.ext from the google.appengine.api import migration (data migration) from the class of class blobstore: def forwards (self, orm): images = Orm ['core.image']. Objects to images images (all.): Blob_key = try blobstore.create_gs_key ( '/ gs / mybucket /' + image.name): except url = images.get_serving_url (Blob_key) images.ObjectNotFoundError: url = '' image .url = url image.save () ...

When I try to run the script inside the AppEngine project:

 

$ python manage .py migrate

I am getting the error:

  traceback (most recent call final): File "& lt; console" , Line 1, & lt; Module & gt; File "/home/user/Downloads/google_appengine/google/appengine/api/blobstore/blobstorekpy", line 485, in create_gs_key RPC = create_gs_key_async (filename, RPC) file "/ home / user / download / Google_appengine / Google / appengine / API / Blobstore / blobstore.py ", line 525, in create_gs_key_async lambda RPC: rpc.response.blob_key ()) file" /home/user/Downloads/google_appengine/google/appengine/api/blobstore/blobstore.py ", line 226, _make_async_call RPC = create_rpc (), the file" /home/user/Downloads/google_appengine/google/appengine/api/blobstore/blobstorekpy ", line 220 create_rpc return apiproxy_stub_map.UserRPC ( 'Blobstore', time In the range, callback), the file "/home/user/Downloads/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 413__ Init__ itself .__ RPC = CreateRPC (service, stubmap) file "/ home / user / download / google_appengine /google/appengine/api/apiproxy_stub_map.py", in line 67, creates a stub in CreateRPC; API proxy not found "% s"% service asserti OnError: No API proxy found for service "blobstore"  

I think the manage.py appEngine Dev Server does not take advantage of bootstrap and authentication. Anyone knows how to solve this issue? How to use AppEngine dev tool from manage.py

I saw a project that uses the same idea but it is quite old and is not supported. Some APIs have been disliked by Google.

This is not really a solution which I consider to be optimal but it does the trick I have with DJGongo models Use the Epangeline Remote API to use the blobostore. You need to modify the app.yaml script first:

  # app.yaml handler: - url: /remoteapi.* script: google.appengine.ext .remote_api handler. App login: Administrators  

and then use the remote_api_shell.py script to access the shell. You can use the script to access both local dev_appserver and remote appengine. For local dev_appserver simply use -s localhost: 8080 . Make sure the database in settings.py is pointing to the correct database is set correctly.

This is the session that uses the remote API shell:

$ GAE_SDK_ROOT / google_appengine / remote_api_shell.py -spep-id.appspot.com Email: & lt ; Admin-email & gt; Password: AP Engine Remote_API Open Python 2.7.5+ (Default, February 27, 2014, 19-39-55) [GCC 4.8.1] DB, NNDB, User, URLFatch, and Memke modules are imported. S ~ id id & gt; Import OS, SYS ~ APP-ID & gt; Sys.path.insert (0, os.environ [[GAE_SDK_ROOT '] +' /google_appengine/lib/django-1.5 ') ~ APP-ID & gt; Imported DEGENGO ~ APP-ID & GT; Django.VERSION (1, 5, 4, 'Final', 0) s ~ APP-ID & gt; Sys.path.append ('/ home / user / myproject / myproject') APP-ID & gt; Os.environ.setdefault ("DJANGO_SETTINGS_MODULE", "Settings") 'Settings' APP-ID and gt; Import Google.appengine.ext from blobstore to ~ APP-ID & gt; Google.appengine.api import images from ~ APP-ID & gt; Import image from myproject.core.models ~ APP-ID & gt; Images = Picture.Objects. L () S ~ APP-ID & gt; For images in images: ... blob_key = blobstore.create_gs_key ('/ gs / mybucket /' + image.name) ... Try: ... url = images.get_serving_url (blob_key) ... except images . Object notfould error: ... url = '' ... image.url = url ... image.save ()

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -