我如何从我的产品App Engine应用程序获取实时数据到我的本地开发应用程序? [英] How do I get live data from my production App Engine app to my local dev app?

查看:143
本文介绍了我如何从我的产品App Engine应用程序获取实时数据到我的本地开发应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人有关于如何配置AppEngine remote_api的指针,以便我可以在本地调试我的代码,但使用remote_api从我的服务器获取一些数据。这样,我就可以测试真实的信息。



谢谢!

解决方案

如果要使用来自High Replication Datastore的数据调试自己的脚本,请阅读在本地客户端上使用Remote API 。首先,您需要在 app.yaml 中启用 remote_api 并上传应用程序。然后您将此部分添加到脚本中:

  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')

现在您可以从高复制数据存储中访问数据,而不是从本地模型中进行访问。



另外,如果您想通过控制台快速将测试数据添加到HRD,我推荐使用PyCharm,它具有使用自定义参数运行脚本的功能。从PyCharm菜单中选择运行 - >编辑配置。创建新的配置,设置以下参数:


  • 名称:脚本名称

  • 脚本:指向您的$ GAE_SDK_ROOT \remote_api_shell.py

  • 脚本参数:-s your_app_id.appspot .com

  • 工作目录:我建议设置它。您可能想要测试实体并成功导入类定义,最好将它放在应用程序的根目录中。因此,将它设置为应用程序的ROOT。


现在当您运行或调试指定的配置时,PyCharm将打开一个python控制台,提示您用您的用户名和密码连接到GAE。现在,您可以使用它来处理Google服务器上的数据。



有关remote_api的更多信息,请阅读:



有关Pycharm自定义配置的更多信息,请阅读:


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:

这篇关于我如何从我的产品App Engine应用程序获取实时数据到我的本地开发应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆