如何在运行时获取应用程序ID

7 投票
2 回答
5271 浏览
提问于 2025-04-16 14:56

我需要应用程序的ID来构建正确的 <applicationid>.appspotmail.com 地址,但我不知道怎么在运行时获取这个ID。

2 个回答

0

你可以通过以下方式获取它:

os.environ['APPLICATION_ID']
13

现在推荐的做法是使用 app_identity.get_application_id() 这个方法:

http://code.google.com/appengine/docs/python/appidentity/functions.html#get_application_id

想了解更多细节,可以查看这里的警告框:

http://code.google.com/appengine/docs/python/runtime.html#Requests_and_Domains

撰写回答