Using the Remote API on dev_appserver.py is essentially the same as using
it in a local Python client, as per the example in 'Remote API for Python
<https://cloud.google.com/appengine/docs/python/tools/remoteapi>'. The most
straightforward way to turn it on globally for your app in the devserver is
to add the setup to your 'appengine_config.py
<https://cloud.google.com/appengine/docs/python/tools/appengineconfig>'
located in your project's root:
import os
if os.environ['SERVER_SOFTWARE'].startswith('Development'):
from google.appengine.ext.remote_api import remote_api_stub
from google.appengine.api import apiproxy_stub_map
local_stub = apiproxy_stub_map.apiproxy.GetStub('urlfetch')
remote_api_stub.ConfigureRemoteApiForOAuth('myapp.appspot.com',
'/_ah/remote_api')
apiproxy_stub_map.apiproxy.ReplaceStub('urlfetch', local_stub)
(Note that replacing the 'urlfetch' stub is necessary to work around a bug,
if interested you can read about it more here
<https://code.google.com/p/googleappengine/issues/detail?id=12835> and here
<https://groups.google.com/forum/#!msg/google-appengine/AWAUBSY0R8k/RHiJZbRYBgAJ>
).
Regarding the 404 with Datastore Admin, if you get this when following the
link from the Cloud Console this usually means the
'ah-builtin-python-bundle' version got deleted from your project. The
simplest way to fix this is to deploy to a new project. If creating a new
project is not an option, you can file a production issue on the issue
tracker <https://code.google.com/p/googleappengine/issues/list> and request
a restore of this bundle.
On Saturday, May 7, 2016 at 7:40:58 AM UTC-4, Rotem Vilkovski wrote:
>
> BTW - in my production I get 404 when I try to reach datastore admin, my
> project id is: 831908763256
> Thanks again.
>
> On Saturday, May 7, 2016 at 2:30:22 PM UTC+3, Rotem Vilkovski wrote:
>>
>> I've done a restore on my testing project. How can I configure my local
>> project turn to the remote datastore? I don't want to upload a version each
>> time I make a little change without check it out locally.
>> Thanks!
>>
>> On Saturday, May 7, 2016 at 12:50:55 PM UTC+3, Rotem Vilkovski wrote:
>>>
>>> Hey Adam, thank you for the comment.
>>> I tried to read some of your documentation about the remote api and it
>>> hasn't helped me at all.
>>> Is there any example for something so basic? I mean this is the most
>>> basic move you need to get you local environment to run and I can't find
>>> anything that you've documented. every documentation just assume you have a
>>> local datastore that fully functions.
>>> Lets say I've done a DatastoreBackup, how do I restore it locally?
>>> Thanks!
>>>
>>> On Tuesday, May 3, 2016 at 6:20:33 PM UTC+3, Rotem Vilkovski wrote:
>>>>
>>>> Hey,
>>>>
>>>> I'm trying to upload data to local Datastore using the file I've
>>>> downloaded from out production using appcfg download_data.
>>>> I get an error almost every time about ProtocolBufferDecodeError:
>>>> corrupted. Sometimes (on the same file) it is just working. This is really
>>>> disturbing and I'd like to know if there's another way to use my local
>>>> datastore with my local file and having a solution for this problem
>>>> please.
>>>> Everytime I update an entity in production and want to update my local
>>>> Datastore it takes me for 10-20 tries.
>>>>
>>>> Stack trace:
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/tools/adaptive_thread_pool.py",
>>>>
>>>> line 172, in WorkOnItems
>>>> status, instruction = item.PerformWork(self.__thread_pool)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/tools/bulkloader.py",
>>>>
>>>> line 750, in PerformWork
>>>> transfer_time = self._TransferItem(thread_pool)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/tools/bulkloader.py",
>>>>
>>>> line 921, in _TransferItem
>>>> self.request_manager.PostEntities(self.content)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/tools/bulkloader.py",
>>>>
>>>> line 1396, in PostEntities
>>>> datastore.Put(entities)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/api/datastore.py",
>>>> line 606, in Put
>>>> return PutAsync(entities, **kwargs).get_result()
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/datastore/datastore_rpc.py",
>>>>
>>>> line 923, in get_result
>>>> results = self.__rpcs[0].get_result()
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/api/apiproxy_stub_map.py",
>>>>
>>>> line 613, in get_result
>>>> return self.__get_result_hook(self)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/datastore/datastore_rpc.py",
>>>>
>>>> line 1881, in __put_hook
>>>> self.check_rpc_success(rpc)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/datastore/datastore_rpc.py",
>>>>
>>>> line 1371, in check_rpc_success
>>>> rpc.check_success()
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/api/apiproxy_stub_map.py",
>>>>
>>>> line 579, in check_success
>>>> self.__rpc.CheckSuccess()
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/api/apiproxy_rpc.py",
>>>>
>>>> line 157, in _WaitImpl
>>>> self.request, self.response)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
>>>>
>>>> line 286, in MakeSyncCall
>>>> handler(request, response)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
>>>>
>>>> line 460, in _Dynamic_Put
>>>> 'datastore_v3', 'Put', put_request, put_response)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
>>>>
>>>> line 201, in MakeSyncCall
>>>> self._MakeRealSyncCall(service, call, request, response)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
>>>>
>>>> line 228, in _MakeRealSyncCall
>>>> response_pb.ParseFromString(encoded_response)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/net/proto/ProtocolBuffer.py",
>>>> line 140, in ParseFromString
>>>> self.MergeFromString(s)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/net/proto/ProtocolBuffer.py",
>>>> line 152, in MergeFromString
>>>> self.MergePartialFromString(s)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/net/proto/ProtocolBuffer.py",
>>>> line 168, in MergePartialFromString
>>>> self.TryMerge(d)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/appengine/ext/remote_api/remote_api_pb.py",
>>>>
>>>> line 770, in TryMerge
>>>> d.skipData(tt)
>>>> File
>>>> "/home/rotem/Desktop/google_appengine/google/net/proto/ProtocolBuffer.py",
>>>> line 673, in skipData
>>>> raise ProtocolBufferDecodeError, "corrupted"
>>>> ProtocolBufferDecodeError: corrupted
>>>>
>>>>
>>>> Thanks!
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/eb217497-02ae-45bf-8757-71af993f81ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.