DAOCLOUD
推荐学习书目
› Python Cookbook
› Using Google App Engine
推荐下载
› Latest Google App Engine SDK
其他兼容技术
› AppScale
crazycookie

GAE 环境判定

  •  
  •   crazycookie · Aug 3, 2011 · 5527 views
    This topic created in 5592 days ago, the information mentioned may be changed or developed.
    在线环境定义为production
    自己本地开发环境为develoption
    我想按照这种方式来定义 配置文件
    这样发布的时候就不需要 修改配置文件了

    请问下 在GAE下面如何判断代码是在 google 服务器上面跑,而不是本地跑呢?
    2 replies  •  1970-01-01 08:00:00 +08:00
    crazycookie
    crazycookie
    OP
    Aug 3, 2011
    1
    自己的屁股自己擦
    os.environ.get('SERVER_SOFTWARE', '').startswith('Development')
    darcy
    darcy
    Aug 3, 2011
    2
    新版本的SDK获取到的application id 也会以dev开头

    - The SDK "application" environment variable will now be prefixed with dev~.
    The new preferred way of retrieving your app id is to use
    appidentity.get_application_id(). The --default partition flag can be used
    for applications whose code relied on a specific environment variable.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1016 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:16 · PVG 03:16 · LAX 11:16 · JFK 14:16
    ♥ Do have faith in what you're doing.