On 9/5/08 3:55 AM, jhf555 wrote:
> Couldn't find this answered yet, so...
> I need to serve one image in development mode, and a different image
> in production mode.  How do I tell which mode I'm in from my app
> engine code?...I'm hoping there's something like:
>   if ENVIRONMENT == "development":
>     img = image1
>   else:
>     img = image2
> 
> Thanks.

server = os.environ.get('SERVER_SOFTWARE','').lower()
if server.startswith('devel'):
    img = image1
elif server.startswith('goog'):
    img = image2
else:
    logging.error('Unknown server: %s. Production/development?' % server)
    image = something_else

-- 
-Brian

Brian Clapper, http://www.clapper.org/bmc/
Controlling complexity is the essence of computer programming.
        -- Brian W. Kernighan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to