gpt4 book ai didi

python - 尝试在 Google App Engine 项目中创建备份时出现 404

转载 作者:太空狗 更新时间:2023-10-29 20:58:34 25 4
gpt4 key购买 nike

设置

我在按照问题 AppEngine datastore - backup programatically未接受 回答后遇到了 404 问题

我已按照一位回答提供者的建议启用了数据存储管理。我可以在 Google App Engine 控制台中手动触发数据存储备份,并且备份运行没有任何失败。

这个问题中的代码位于一个名为“app”的模块中。不是“默认”。

404问题

这是 cron.yaml 中的 cron 作业。

cron:
- description: Regular backup
url: /_backup/fullbackup
schedule: every 24 hours

url 的处理程序会将备份任务放入队列中,然后调用

_ah/datastore_admin/backup.create?
gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent
&kind=TestDocument&filesystem=gs

(我在这里用'test'替换了我的app id)

这在日志中显示了一个 404 错误。

enter image description here

如果我在浏览器中将上述 url 与我的应用程序主机名一起使用(即 https://test.appspot.com/_ah/datastore_admin/backup.create?
gs_bucket_name=%2Fgs%2Ftest.appspot.com%2F21-06-2015&kind=Test&kind=TestContent
&kind=TestDocument&filesystem=gs
), 我也收到 404。

enter image description here

这里是路由/_backup/fullbackup handler中的相关代码

    task = taskqueue.add(
url='/_ah/datastore_admin/backup.create',
method='GET',
target='ah-builtin-python-bundle',
params={
'filesystem': 'gs',
'gs_bucket_name': self.get_bucket_name(),
'kind': (
'Test',
'TestContent',
'TestDocument'
)
}
)

问题:

  • 问题的原因是什么?
  • 我是否需要在 python 代码的 taskqueue.add 部分中使用队列名称?
  • 在我的 cron.yaml 中,是否需要将目标设置为 ah-builtin-python-bundle

编辑

内置的 datastore-admin 已启用,如屏幕截图所示。

并且没有dispatch.yaml

enter image description here

最佳答案

有没有enabled the Datastore Admin ?您需要完成此操作才能允许模块 ah-builtin-python-bundle 存在,这是一个在您激活数据存储管理时“部署”到您的应用程序的特殊模块,这实际上是负责响应对 /_ah/datastore_admin 的请求并生成从 Datastore 读取并在 Cloud Storage(或您将它们发送到的任何其他地方)中生成备份文件的 MapReduce 作业。

此外,另一种可能性是您已将 test.appspot.com 硬编码到您的应用中。您拥有该应用程序 ID“测试”吗?从您在浏览器中看到的错误屏幕截图来看,您似乎正在尝试备份到存储桶“test.appspot.com”,这将是应用程序 ID 为“测试”的应用程序。但是,在您显示的日志屏幕截图中,它还尝试备份到“example.appspot.com”存储桶。确保您的应用拥有这些存储桶。

另一种可能性是处理请求的模块不是 ah-builtin-python-bundle,而是另一个模块。如果您有 dispatch rule,即使您在任务添加方法中指定了不同的目标,也可能会发生这种情况。这是重新路由请求。

关于python - 尝试在 Google App Engine 项目中创建备份时出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30970735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com