5

I'd like to know if anyone has pointers about how to configure AppEngine remote_api, to so that I can debug my code locally but use the remote_api to fetch some data from my server. That way, I can test against real information.

Thanks!

Juan Carlos Coto
  • 11,900
  • 22
  • 62
  • 102

2 Answers2

1

You could download data as described here, and use it to populate your local dev app. There's no reason that PyCharm needs to be involved.

allyourcode
  • 21,871
  • 18
  • 78
  • 106
  • Yes, it could definitely be done. The problem is, what happens when I have a large dataset and wish to be able to run queries on it? I COULD download gigabytes of data, but that's not the idea. I believe the only solution would be to use the remote_api to forward calls to the server. Good call on PyCharm not being involved. – Juan Carlos Coto Sep 28 '12 at 14:13
1

If you want to debug your own script with using data from High Replication Datastore, then read Using the Remote API in a Local Client. First you need to enable remote_api in app.yaml and upload the application. Then you add this part to your script:

from google.appengine.ext.remote_api import remote_api_stub

def auth_func():
   return ('your_username', 'your_password')

remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func, 'your-app-id.appspot.com')

Now you access data from High Replication Datastore instead from local mockup.

Also if you want to quickly add test data to HRD through console I recommend using PyCharm, which has a feature of running scripts with custom parameters. From PyCharm Menu select Run->Edit Configurations. Create new configuration, set the following parameters:

  • Name: Name of the script
  • Script: Point to your $GAE_SDK_ROOT\remote_api_shell.py
  • Script parametres: -s your_app_id.appspot.com
  • Working directory: I recommend setting this. You probably want to test entities and to successfully import class definitions it is best to be in root directory of your application. So set it to ROOT of your application.

Now when you run or debug specified configuration PyCharm will open a python console, prompting you to connect to GAE with your username and password. Now you can use it for manipulating data on Google servers.

For more information on remote_api read:

For more information on Pycharm custom configurations, read:

Jernej Jerin
  • 3,179
  • 9
  • 37
  • 53