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

GAE 环境判定

  •  
  •   crazycookie · Aug 3, 2011 · 5192 views
    This topic created in 5400 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
        1
    crazycookie  
    OP
       Aug 3, 2011
    自己的屁股自己擦
    os.environ.get('SERVER_SOFTWARE', '').startswith('Development')
    darcy
        2
    darcy  
       Aug 3, 2011
    新版本的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   ·   Solana   ·   2986 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 09:33 · PVG 17:33 · LAX 02:33 · JFK 05:33
    ♥ Do have faith in what you're doing.