I'm using django with appengine_django. In settings.py, when I iterate through and the os.environ keys, SERVER_SOFTWARE does not appear, so If I try that, I get a KeyError.
On Jan 6, 7:26 pm, Nickolas Daskalou <[email protected]> wrote: > What about: > > import os > > if 'Development' == os.environ['SERVER_SOFTWARE][:11]: > # On dev server > else: > # On production server > > Does that work for you johnwlockwood? > > 2010/1/7 johnwlockwood <[email protected]> > > > > > OK, that doesn't seem to work. > > > I personally do this, and I know it works: > > > import os > > PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) > > > if not PROJECT_ROOT.startswith("/base/data/home/apps/MYAPPNAME"): > > DEVELOPMENT = True > > DEBUG = True > > GOOGLE_MAPS_API_KEY = "VSE..." > > else: > > DEVELOPMENT = False > > DEBUG = False > > GOOGLE_MAPS_API_KEY = "GER..." > > > On Jan 6, 5:40 pm, johnwlockwood <[email protected]> wrote: > > > You can use: > > > > if os.environ['SERVER_SOFTWARE'].contains('Development') > > > > -John > > > > On Jan 2, 10:26 pm, Jeremy Faller <[email protected]> wrote: > > > > > Hello all: > > > > > I've been fooling with AppEngine and the Google Maps APIs, and I'm > > > > running into a bit of a snag. The Google Maps APIs require a 'key' > > > > url parameter. The key parameter is hashed to your domain name, so if > > > > I've got a <img> tag from localhost, the key differs than from when > > > > I'm running on the Google servers. > > > > > I'd like to programmatically switch the key depending on whether I'm > > > > running in the development server on my localhost, or on Google's > > > > infrastructure. Does anyone know an API that I can call that will > > > > tell me if I'm running in debug mode or not? Specifically, I'm > > > > looking for (in python): > > > > > _LOCALHOST_KEY= 'ABQIAAAAnfs7bKE82qgb3Zc2YyS- > > > > oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA' > > > > _MY_DOMAIN_KEY = 'xyzpdq' > > > > > def GoogleMapsKey(): > > > > if IsRunningLocalHost(): # What's this API? > > > > return _LOCALHOST_KEY > > > > return _MY_DOMAIN_KEY > > > > > Thanks in advance. > > > > > Regards, > > > > Jeremy Faller > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-appengine%2Bunsubscrib > > [email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine?hl=en.
-- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
