How can I detect the development server?

449 views
Skip to first unread message

Mark Jones

unread,
Jul 22, 2009, 12:42:45 PM7/22/09
to Google App Engine
I need code to behave one way on my dev server and another on the real
GAE. How can I detect the dev server.

Specifically I need to NOT replace imp.find_module so that WingIDE
debugging will work, but I need it to be replaced when the code is
pushed to GAE

Nick Johnson (Google)

unread,
Jul 22, 2009, 12:49:08 PM7/22/09
to google-a...@googlegroups.com
Hi Mark,

Just check if os.environ['SERVER_SOFTWARE'].contains('Development')

-Nick Johnson
--
Nick Johnson, App Engine Developer Programs Engineer
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration
Number: 368047

Mark Jones

unread,
Jul 24, 2009, 1:25:27 PM7/24/09
to Google App Engine
I also discovered this today:

http://code.google.com/p/app-engine-patch/wiki/RagendjaOther

On Jul 22, 11:49 am, "Nick Johnson (Google)" <nick.john...@google.com>
wrote:
> Hi Mark,
>
> Just check if os.environ['SERVER_SOFTWARE'].contains('Development')
>
> -Nick Johnson
>
> On Wed, Jul 22, 2009 at 5:42 PM, Mark Jones<mark0...@gmail.com> wrote:
>
> > I need code to behave one way on mydevserverand another on the real

Jaap Taal

unread,
Aug 6, 2009, 7:08:03 AM8/6/09
to google-a...@googlegroups.com
Nick,

If I'm not mistaken:
AttributeError: 'str' object has no attribute 'contains'
Should be:
os.environ['SERVER_SOFTWARE'].find('Development') >= 0

your comment was helpful, though

Jaap

Nick Johnson (Google)

unread,
Aug 6, 2009, 8:22:11 AM8/6/09
to google-a...@googlegroups.com
On Thu, Aug 6, 2009 at 12:08 PM, Jaap Taal<ja...@q42.nl> wrote:
> Nick,
> If I'm not mistaken:
> AttributeError: 'str' object has no attribute 'contains'

You're correct. I meant to say 'startswith', not 'contains.

-Nick
--
Nick Johnson, Developer Programs Engineer, App Engine
Reply all
Reply to author
Forward
0 new messages