我正在開發一個GAE應用程序,並且我想要設置一些全局變量來進行一次初始化。目前我只是在main.py中執行此操作,但似乎正確的做法是使用Warmup Requests。如何實現全局變量初始化的預熱請求
Where is the best place to put one-time and every-time code in GAE/Python?
https://developers.google.com/appengine/docs/adminconsole/instances#Loading_Requests
有人可以給我解釋一點在這裏詳細的代碼應該去使用webapp2的,使這項工作?在簡單的用例中,我只想設置一個全局變量,它具有一個名稱列表,並且可以在應用程序的任何其他地方訪問它。例如:
# init code
NAMES = ['u1', 'u2', 'u3']
# somewhere else in the app
if 'u1' in NAMES:
# do stuff