app caching results in blank page on first load

133 views
Skip to first unread message

efless

unread,
Jul 2, 2008, 5:52:33 AM7/2/08
to Google App Engine
I converted a google app handler script that uses Datastore operations
and memcache to also use app caching as described on:
http://code.google.com/appengine/docs/python/appcaching.html

However, on the first invocation of the handler script on the Mac SDK
I get a blank page. A single "GET / HTTP/1.1" 200" request registers
on the console, but there is a blank response to the browser. The
resulting web page is blank. A reload of the page is successful and
all subsequent operations are successful.

I also get a blank page on the live server after uploading the
handler script on first invocation (even after only adding a newline).
Generally, all subsequent invocations are successful. I have seen a
single instance of a subsequent invocation resulting in a blank page.
It seems like the first invocation of the handler on a given server
results in a blank page, with subsequent invocations being successful.

The global variables that I have are: a single compiled regular
expression and a few GqlQuery objects, which I bind() to new
parameters when I use them. If I remove the main() function to
eliminate app caching, the blank page response never happens and the
handler script runs with no errors. Turning app caching back on brings
back the blank response on the first load.

This is driving me batty. I can't seem to find anything relevant
through web and group searches.

Is there something I am missing? Does something special occur on first
invocation that could interact with my handler script?

Any suggestions are very appreciated.

thanks,
efless

Marzia Niccolai

unread,
Jul 2, 2008, 1:27:19 PM7/2/08
to google-a...@googlegroups.com
Hi,

Most likely, you have forgotten this:

if __name__ == '__main__':
  main()

At the end of your file.

-Marzia

[http://groups.google.com/group/google-appengine/browse_thread/thread/744a71d0f0cda3dc/585ad2cb122d0bbf]

efless

unread,
Jul 3, 2008, 5:53:07 AM7/3/08
to Google App Engine
Thanks for the post. Good guess. I just found the answer and you're
very close.

I actually had:

if __name__ == '__main___':
main()

Do you see the problem? It seems very obvious to me now (and the
display font that I see here is better than the font in my text
editor). There are three underscores at the end of '__main___', but
there should only be two underscores. So the if statement doesn't
succeed on first load but main() is called directly on subsequent
cached loads, which is the same symptom as not having this code
fragment at all.

thanks,
efless

On Jul 2, 10:27 am, "Marzia Niccolai" <ma...@google.com> wrote:
> Hi,
>
> Most likely, you have forgotten this:
>
> if __name__ == '__main__':
>   main()
>
> At the end of your file.
> -Marzia
>
> [http://groups.google.com/group/google-appengine/browse_thread/thread/...
> ]
Reply all
Reply to author
Forward
0 new messages