방금 Python을 사용하여 Google App Engine을 시작했으며 웹 응용 프로그램 프레임 워크를 익숙하게하기 위해 자습서를 읽고 나만의 작은 응용 프로그램을 작성했습니다. 이제 방금 튜토리얼에서 다음을 확인했습니다. self.redirect('/')
. 그래서 저에게 궁금한 점이 있습니다 : 하드 코딩 된 경로 대신 처리기로 리디렉션 할 수있는 방법이 있습니까? 앱을 손상시키지 않고 URL을 변경할 수 있도록하는 것이 더 나을 것이라고 생각할 수 있습니다.Google App Engine : Redirect to RequestHandler
3
A
답변
3
다른 대안은 매핑 된 URL로 리디렉션 할 수있는 방식으로 심볼 이름을 URL에 매핑하는 것입니다. 그런 다음 URL을 무방비로 업데이트 할 수 있습니다.
다른 처리기에서 코드를 실행하고 싶다면 메서드 호출을 할 수없는 이유를 모르겠습니다. 최악의 경우 두 핸들러에서 공통 메서드를 추출하여 호출 할 수 있습니다. .
1
이것은 App Engine의 제한 사항이 아니므로 webapp 프레임 워크만큼이나 중요합니다. webapp는 필수 요소 만 제공하는 가벼운 프레임 워크입니다.
fancier redirect behavior을 원할 경우 장고를 사용해보십시오.
0
은 허용 대답은 내가 webapp2에 당신이 당신의 경로 이름을 지정하고 다음 webapp2 Uri routing
app = webapp2.WSGIApplication(
routes=[webapp2.Route('/', handler='RootController', name='root')])
에 설명 된대로 그 이름을 사용하여 리디렉션 다음 RequestHandler를 그들에게 리디렉션 할 수 있습니다 실현하기 전에 내 자신의 작은 라우터를 내장했다
self.redirect_to('root')
경로가 자리 당신이 자리에 대한 값을 제공 할 수 있고, webapp2.Router 당신을 위해 올바른 URI를 구축 할 것입니다 포함 된 경우. 더 자세한 정보는 webapp2 Uri routing을 다시보십시오.
관련 문제
- 1. Google App Engine (Python)의 RequestHandler 외부에서 uri 요청 받기
- 2. Google App Engine self.redirect 게시물
- 3. Google App Engine - JDODetachedFieldAccessException
- 4. Silverlight의 Google App Engine
- 5. Google App Engine MemcacheException
- 6. Google App Engine Memcache
- 7. Google App Engine 인증
- 8. Google App Engine 데이터베이스
- 9. Google App Engine 인증
- 10. Google App Engine Appstats
- 11. Google App Engine : DeadlineExceededError
- 12. Google App Engine
- 13. Google App Engine : get_or_create()?
- 14. Google App Engine 문제
- 15. Google App Engine - Deadlocking?
- 16. Google App Engine 프록시
- 17. 확인 SMS - Google App Engine
- 18. app engine : string to datetime?
- 19. Google App Engine 대량 다운로드
- 20. iPhone App with Google App Engine
- 21. Google App Engine 작업 대기열
- 22. Google App Engine 프로젝트 계층
- 23. template.render() Google App Engine (python)
- 24. Google App Engine 업로드 자동화하기
- 25. Google App Engine 데이터베이스 인덱스
- 26. Google App Engine - 속도가 빠름
- 27. Google App Engine Geo Query
- 28. Google App Engine : JSON 모듈
- 29. Google App Engine Barrier 동기화
- 30. Google App Engine 상시 기능