确定我的App Engine代码在哪个项目ID上运行 [英] Determine what project id my App Engine code is running on

查看:51
本文介绍了确定我的App Engine代码在哪个项目ID上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在App Engine应用程序中,是否可以确定正在运行GAE(App Engine)实例的项目ID?

From within an App Engine app, is there a way to determine the project ID a GAE (App Engine) instance is running on?

我想在运行App Engine实例的同一项目中访问一个大查询表.我宁愿不对其进行硬编码,也不希望将其包含在另一个配置文件中.

I want to access a big query table in the same project that the App Engine instance is running in. I'd rather not hard code it in or include it in another config file if possible.

忘了说这是来自Python

forgot to mention that this is from Python

推荐答案

您可以从环境变量中获取很多信息:

You can get a lot of info from environment variables:

import os
print os.getenv('APPLICATION_ID')
print os.getenv('CURRENT_VERSION_ID')
print os.environ

这篇关于确定我的App Engine代码在哪个项目ID上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆