Вопрос

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!

Это было полезно?

Решение

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:

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top