【问题标题】:Automatic setup of App Engine Remote API on webapp2在 webapp2 上自动设置 App Engine Remote API
【发布时间】:2023-03-09 16:41:01
【问题描述】:

在 Python 2.7 上为 AppEngine 配置 remote_api,我需要设置配置调用来创建和配置数据库调用存根,这样我就不必在每个 REST 资源和处理程序中复制配置调用。我想要的代码是这样的:

def configure_remote_api():
    try:
        from google.appengine.ext.remote_api import remote_api_stub
        remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func, 'myapp.appspot.com')
    except ImportError:
        pass

我想要的是将它设置为模块化调用,并且不必在整个应用程序代码中复制,甚至 configure_remote_api()。这样,我们可以保持我们的代码库干净,并在本地开发时自动使用 remote_api。我该怎么做?

【问题讨论】:

    标签: google-app-engine python-2.7 remoteapi


    【解决方案1】:

    也许您可以将调用放在 appengine_config.py 中。这通常会很早就加载。 (但请检查。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-16
      • 1970-01-01
      • 2014-09-01
      • 2011-10-10
      • 1970-01-01
      • 2017-04-20
      • 2015-06-22
      • 1970-01-01
      相关资源
      最近更新 更多