Comments on this assumption about running on dev server vs a real instance in app engine (python)?
Posted
by Jacob Oscarson
on Stack Overflow
See other posts from Stack Overflow
or by Jacob Oscarson
Published on 2010-06-13T10:32:32Z
Indexed on
2010/06/13
10:42 UTC
Read the original article
Hit count: 214
python
|google-app-engine
Hello app engineers! I'm on an app engine project where I'd like to put in a link to a Javascript test runner that I'd like to only exist when running the development server. I've made some experiments on a local shell with configuration loaded using the technique found in NoseGAE versus live on the 'App Engine Console' [1] and it looks to me like a distinction btw real instance and dev server is the presence of the module google.appengine.tools
. Which lead me to this utility function:
def is_dev():
"""
Tells us if we're running under the development server or not.
:return:
``True`` if the code is running under the development server.
"""
try:
from google.appengine import tools
return True
except ImportError:
return False
The question (finally!) would be: is this a bad idea? And in that case, can anyone suggest a better approach?
[1] http://con.appspot.com/console/ (try it! very handy indeed)
© Stack Overflow or respective owner