Robin That sounds the right place to set that the WEB2PY_RUNTIME is 'GOOGLE' but it begs the questions:
Shouldn't there be a non-google value set somewhere else (wsgihandler.py?) and what would the value be ('WSGI'?)? Would it be prefereable to be a boolean (IS_GAE=True) and set elsewhere to False? (I suppose this has problem if another application engine comes along). As there is already an environ key 'SERVER_SOFTWARE' why create another key 'WEB2PY_MODE'? Bill On Feb 1, 12:36 pm, Robin B <robi...@gmail.com> wrote: > You are right importing 'google' is insufficient for detection, but > detecting GAE side effects is only slightly better. > > All GAE apps start in gaehandler.py. Simply set the environment > variables in side of gaehandler.py, it results in 100% fool proof > detection. > > At the top of gaelhander.py: > > # foolproof detection in 1 line > os.environ['WEB2PY_RUNTIME'] = 'GOOGLE' > # also set the mode > if os.environ.get('SERVER_SOFTWARE','').startswith('Devel'): > os.environ['WEB2PY_MODE'] = 'DEVELOPMENT' > else: > os.environ['WEB2PY_MODE'] = 'PRODUCTION' > > Robin > > On Feb 1, 4:35 am, billf <billferr...@blueyonder.co.uk> wrote: > > > As a short-term solution, I am using the following patch: > > > In compileapp.py, is_gae is set depending on the result of > > imp.get_magic() so in build_environment() in the same module I store > > is_gae in environment['GAE']. Then in db.py I can say > > > if globals()['GAE']: before importing google stuff and using GQLDB() > > > Have I a) re-invented the wheel, b) come up with a good solution, c) > > missed something important? > > > On Feb 1, 9:06 am, billf <billferr...@blueyonder.co.uk> wrote: > > > > I have installed the google appengine but do not want web2py to use > > > the google datastore just because the libs are there but that is what > > > the welcome app does. > > > > I have read some threads related to detecting GAE but they seemed > > > inconclusive. > > > > Is there a way that, in a model (or elsewhere for that matter) I can > > > detect if the app is running on GAE that doesn't depend on the > > > presence of google libs? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---