2010-02-17 2 views
13

데이터 저장소를 읽기 전용 모드로 설정하는 Google의 예약 된 유지 관리를 시뮬레이트하기 위해 읽기 전용 모드로 App Engine dev 서버를 실행하는 방법이 있습니까?App Engine SDK DevServer 읽기 전용 모드?

Gracefully Degrading During Scheduled Maintenance

+2

1 : 재미있는 질문! 어쩌면 GAE 이슈 트래커에 "문제"를 제기 할 수 있습니까? – jldupont

+0

아주 조심스러운 관찰. 아마도 Nick Johnson은이 사실을 알아 차리고 빠르게 추적 할 수있게 도와 줄 것입니다. 부디? –

+2

GAE 문제 # 1811이 있습니다. 사용자 관리자가 테스트를위한 기능을 사용 중지하도록 허용합니다.이 기능은 거의 똑같은 기능을 요구하며 해결책이 아직없는 것 같습니다. 바라건대, Google이 우선 순위를 정할 것입니다. –

답변

2

나는 데이터 저장소 읽기 전용으로 만들 수있는 체크 박스가 있었다 바랍니다. 이 해킹은 내가 필요한 것을 수행하는 것 같습니다. 주 핸들러에 다음을 넣어 :

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

+0

좋은 해결책 인 것처럼 보이지만 아직 테스트하지 않았습니다. Nick Johnson이 최근이 문제에 대한 게시물을 작성했습니다. http://blog.notdot.net/2010/03/Handling-downtime-The-capabilities-API-and-testing Capabilities API에 대해 자세히 알아 봅니다. 후크 들어. –