我這樣做是按照Custom Error Responses - app.yaml中與如果超過配額,如何顯示單獨的頁面?
error_handlers:
- error_code: over_quota
file: templates/over_quota.html
更新,並根據創建文件。但仍顯示錯誤(例外)而不是該頁面。我試圖把文件放在根文件夾中(根據app.yaml更新) - 它沒有幫助。
我在做什麼錯?
Upd。我按照@Gwyn Howell的評論以下列方式定義了這一點。
handlers:
- url: /over_quota.html
static_files: templates/over_quota.html
upload: templates/over_quota.html
error_handlers:
- error_code: over_quota
file: over_quota.html
但是(1)如何測試它,(2)哪個url用戶將在結果中看到? http://www.example.com/over_quota.html
還是會原創的網址?
你有沒有將templates/over_quota.html映射到app.yaml中的頁面處理程序?如果您轉到/templates/over_quota.html,會發生什麼情況? –
@GwynHowell,謝謝你的幫助。如果我轉到/templates/over_quota.html,該頁面不會顯示。我還沒有定義頁面處理程序。它應該是什麼樣子?我正在閱讀https://developers.google.com/appengine/docs/python/config/appconfig#Static_File_Pattern_Handlers,但它對我沒有幫助。用戶將會看到什麼?將它是原始的網址或其他? –
@GwynHowell,請發表您的評論作爲答案。我也更新了這個問題。 –