gpt4 book ai didi

google-app-engine - App Engine SDK DevServer 只读模式?

转载 作者:太空宇宙 更新时间:2023-11-03 15:18:50 26 4
gpt4 key购买 nike

有没有办法以只读模式运行 App Engine 开发服务器,以模拟 Google 将数据存储区置于只读模式的计划维护?

Gracefully Degrading During Scheduled Maintenance

最佳答案

我希望有一个复选框可以将数据存储设置为只读。这个 hack 似乎可以满足我的需要。将以下内容放入您的主处理程序中:

from google.appengine.runtime.apiproxy_errors import CapabilityDisabledError
from google.appengine.api import apiproxy_stub_map

def make_datastore_readonly():
"""Throw ReadOnlyError on put and delete operations."""
def hook(service, call, request, response):
assert(service == 'datastore_v3')
if call in ('Put', 'Delete'):
raise CapabilityDisabledError('Datastore is in read-only mode')
apiproxy_stub_map.apiproxy.GetPreCallHooks().Push('readonly_datastore', hook, 'datastore_v3')

def main():
make_datastore_readonly()

它是在这里找到的: http://groups.google.com/group/google-appengine/msg/51db9d51401715ca

关于google-app-engine - App Engine SDK DevServer 只读模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2283824/

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